We present a full quantum treatment of a five-level atomic system coupled to two quantum and two classical light fields. The two quantum fields undergo a cross-phase modulation induced by electromagnetically induced transparency. The performance of this configuration as a two-qubit quantum phase gate for travelling single-photons is examined. A trade-off between the size of the conditional phase shift and the fidelity of the gate is found. Nonetheless, a satisfactory gate performance is still found to be possible in the transient regime, corresponding to a fast gate operation.PACS numbers: 03.67. Mn, 42.50Gy, Single photons are natural candidates for the implementation of quantum information processing systems [1]. This is due to the photon's robustness against decoherence and the availability of single-qubit operations. However, it is difficult to realize the necessary two-qubit operations since the interaction between photons is very small. A possible solution is the enhancement of photon-photon interaction either in cavity QED configurations [2] or in dense atomic media exhibiting electromagnetically induced transparency (EIT) [3]. In this latter case, optical nonlinearities can be produced when EIT is disturbed, either by introducing additional energy level(s) [4,5], or by mismatching the probe and control field frequencies [6,7].In this letter, we address the feasibility of EIT-based systems for the implementation of a two-qubit quantum phase gate (QPG) for travelling single photons [8,9,10], by means of a full quantum treatment of the system dynamics. In a QPG, one qubit gets a phase conditional to the other qubit state according to the transformation [11,12] |i 1 |j 2 → exp {iφ ij } |i 1 |j 2 where {i, j} = 0, 1 denote the logical qubit bases. This gate is universal when the conditional phase shift (CPS)is nonzero, and it is equivalent to a CNOT gate up to local unitary transformations when φ = π [11,12]. The existing literature focused only on the evaluation of the CPS and on the best conditions for achieving φ = π [8, 9, 10], while the gate fidelity, which is the main quantity for estimating the efficiency of a gate, has been never evaluated. In this letter we calculate both the fidelity and the CPS of the QPG, enabling us to discover a general trade-off between a large CPS and a gate fidelity close to one, hindering the QPG operation. However, we show that this trade-off can be bypassed in the transient regime, which has never been considered before in EIT situations, still allowing a satisfactory gate performance. The qubits are given by polarized single-photon wave packets with different frequencies, and the phase shifts φ ij are generated when these two pulses cross an atomic ensemble in a five-level "M" configuration (see Fig. 1 The population is assumed to be initially in the ground state |3 . From this ground state, it could be excited by either the single-photon probe field, coupling to transition |3 ↔ |2 , or by the single-photon trigger field, coupling to transition |3 ↔ |4 . If the five level...