A high-power laser beam illuminates a photocathode surface placed on an end wall of an RF cavity. The emitted electrons are accelerated immediately to a relativistic energy by the strong RF field in the cavity. But space charge effect induces beam emittance growth especially near the cathode where the electrons are still nonrelativistic. This paper analyzes the factors which lead the transverse emittance growth and method how t o resolve this problem. After introducing solenoidal focusing near the photocathode, the beam emittance growth is suppressed dramatically. The beam emittance is given also after compensation and simulation results. The measurements show the se results are coincident.