Magnetic focusing of intense relativistic electron beams