Scientists have discovered evidence that galactic magnetic fields form early on in a galaxy's life and then stay relatively stable, based on observations of another galaxy around 5 billion light-years away from our part of the cosmos.

The magnetic field around this galaxy is similar in strength and configuration to our own Milky Way, and that means astronomers could learn a lot from it about how magnetism in the Universe works.

Before now, no one has measured a galactic magnetic field so far away, or at such an early stage of life – the distant galaxy is 5 billion years younger than our own, and yet it has a comparable magnetic field.

"This means that magnetism is generated very early in a galaxy's life by natural processes, and thus that almost every heavenly body is magnetic," says one of the team, Bryan Gaensler from the University of Toronto in Canada. "The implication is that we need to understand magnetism to understand the Universe."

Magnetic fields around galaxies are much weaker than those around planets – the Milky Way's field is about a million times weaker than Earth's, for instance – and one hypothesis is that galactic magnetic fields get stronger over time.

Not so, according to the measurements of galaxy CLASS B1152+199, carried out by the Karl G. Jansky Very Large Array observatory in New Mexico.

Getting a fix on readings like this is very difficult because magnetic fields can't be detected at such mind-blowing distances. Instead, the researchers measured the field by the effect it had on the light of a quasar behind it.

That's known as the Faraday effect, the way that the magnetic field polarises the light coming through it, and it was crucial in this study.

If the quasar and CLASS B1152+199 hadn't lined up so neatly, we wouldn't have been able to measure its magnetic field, and discover it was so similar to the Milky Way's.

"This finding is exciting," says lead researcher Sui Ann Mao, from the Max Planck Institute for Radio Astronomy in Germany. "It is now the record holder of the most distant galaxy for which we have this magnetic field information."

There's still a lot we don't know about how magnetism works on a cosmic scale, and so it's tricky to say right away exactly how this research could be used in the future.

What we are sure about is that magnetic fields are very important in the way our Universe is put together, and now we've got some invaluable new evidence for studying them.

"Nobody knows where cosmic magnetism comes from or how it was generated," says Gaensler. "But now, we have obtained a major clue needed for solving this mystery, by extracting the fossil record of magnetism in a galaxy billions of years before the present day."

The research has been published in Nature Astronomy.