In physics , the magnetic field is a field that permeates space and which exerts a magnetic force on moving electric charges and magnetic dipoles . Magnetic fields surround electric currents , magnetic dipoles , and changing electric fields . Finally , magnetic charge fails to account for magnetism that is produced by electric currents nor the force that a magnetic field applies to moving electric charges .