In this paper a new method is presented to neutralize the rf-induced emittance blow-up generated inside rf electron guns. The method is based on a multi-mode operation of the rf gun cavity, which must be able to support both the accelerating mode (TM 010-π ) and a higher harmonic mode. The analytical study of the beam dynamics, which has been found in good agreement with the numerical simulations, shows that the growth of the normalized rms emittance, produced by the time-dependent rf forces during the acceleration in the gun, can be cancelled up to fourth-order terms. This is of great relevance for the improvement of rf gun performances, since the rf field contribution to the emittance blowup becomes negligible and no more dependent on bunch sizes, allowing in this way a natural damping also of the space charge induced emittance simply by using longer bunches, i.e., decreasing the charge density.