The precise origin of this magnetism is complicated, but it is thought to be due to what is known as a geo-dynamo effect, whereby electric currents are generated by the circulation of liquid metals in the earth’s core, which in turn generates a magnetic field.