conditional phase shift (CPS) $$\label{eq:def_cps}
\phi = \phi_{11} + \phi_{00} -\phi_{10} -\phi_{01},$$ is nonzero, and it is equivalent to a CNOT gate up to local unitary transformations when $\phi=\pi$ [@Lloyd95; @NielsenChuang]. Most of the literature focused only on the evaluation of the CPS and on the best conditions for achieving $\phi=\pi$ [@Lukin00; @Ottaviani03; @Petrosyan02; @tripod; @Masalas04], while the gate fidelity, which is the main quantity for estimating the efficiency of a gate, has been evaluated in the full quantum limit in Ref. [@rapcomm] for the first time. Here we provide the details of the calculation of the fidelity and the CPS of Ref. [@rapcomm], which showed the presence of a general *trade–off* between a large CPS and a gate fidelity close to one, hindering the QPG operation, in the stationary state. However, we shall see that this trade-off can be partially 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 $\phi_{ij}$ are generated when these two pulses cross an atomic ensemble in a five-level *M* configuration (see Fig. \[fig:5levelscheme\]). The population is assumed 