We investigate the quantum regime of a high-gain free-electron laser starting from noise. In the first part, we neglect the radiation propagation and we formulate a quantum linear theory of the N-particle free-electron laser Hamiltonian model, quantizing both the radiation field and the electron motion. Quantum effects such as frequency shift, line narrowing, quantum limitation for bunching and energy spread, and minimum uncertainty states are described. Using a second-quantization formalism, we demonstrate quantum entanglement between the recoiling electrons and the radiation field. In the second part, we describe the field classically but we include propagation effects (i.e. slippage) and we demonstrate the novel regime of quantum SASE with high temporal coherence and discrete spectrum. Furthermore, we describe "quantum purification" of SASE: the classical chaotic spiking behavior disappears and the spectrum becomes a series of discrete very narrow lines which correspond to transitions between discrete momentum eigenstates (which originate high temporal coherence). © 2006 The American Physical Society