The propagation of intense laser pulses and the generation of high energy electrons from the underdense plasmas are investigated using two dimensional particle-in-cell simulations. When the ratio of the laser power and a critical power of relativistic self-focusing is the optimal value, it propagates stably and electrons have maximum energies.