We study the angular distribution of relativistic electrons generated through laser-plasma interaction with pulse intensity varying from 10(18) W/cm2 up to 10(21) W/cm2 and plasma density ranging from 10 times up to 160 times critical density with the help of 2D and 3D particle-in-cell simulations. This study gives clear evidence that the divergence of the beam is an intrinsic property of the interaction of a laser pulse with a sharp density gradient. It is entirely due to the excitation of large static magnetic fields in the layer of interaction. The energy deposited in this layer increases drastically the temperature of the plasma independently of the initial temperature. This makes the plasma locally collisionless and the simulation relevant for the current experiments.