The Sun’s magnetic field is not as deep as previously thought, scientists have said, shedding new light on its mysterious origins that have puzzled astronomers for 400 years.

Dark patches on the Sun known as sunspots – the tell-tale signs of magnetic solar activity – was documented by Italian astronomer Galileo as early as 1612.

Since then, scientists have attempted to understand where the Sun’s ever-changing magnetic field comes from.

The widely held view is that it is generated deep within the star, around 130,000 miles below the Sun’s surface.

However, modelling now suggests this may not be the case and the solar phenomenon is much shallower than previously thought – about 20,000 miles underneath.

They said the findings, published in the journal Nature, could help scientists more accurately forecast powerful solar storms that cause the Northern Lights to appear in the night skies.

These storms can also cause cause destruction – wrecking Earth-orbiting satellites, electricity grids and radio communications – so knowing when these events will occur can prepare countries worldwide for potential damage.

Daniel Lecoanet, an assistant professor at Northwestern University’s Department of Engineering Sciences and Applied Mathematics in the US, said: “Understanding the origin of the Sun’s magnetic field has been an open question since Galileo and is important for predicting future solar activity, like flares that could hit the Earth.”

A solar flare on the left side of the Sun and an eruption of solar material shooting through the sun’s atmosphere (Nasa/Goddard/SDO)

He added: “Although many aspects of solar dynamics remain shrouded in mystery, our work makes huge strides in cracking one of the oldest unsolved problems in theoretical physics and opens the way to better predictions of dangerous solar activity.”

The sunspots and flares that appear on the Sun’s surface are driven by its magnetic field, which is internally generated through a process called dynamo action.

To find out more, the researchers developed state-of-the-art models to simulate the solar magnetic field.

It showed that changes in the flow of the super-hot ionised gas (known as the plasma) within the Sun’s surface layers were enough to generate magnetic fields in the same regions.

In contrast, the researchers said, the changes in deeper layers produced less realistic solar fields, concentrated near the Sun’s poles rather than the equator.

The models were also able to demonstrate how sunspots are linked to the Sun’s magnetic activity.

The researchers said the patterns seen in the simulations matched the locations and timescales of sunspots that have been have observed by astronomers since Galileo.

Keaton Burns, a research scientist in Massachusetts Institute of Technology’s Department of Mathematics in the US, said: “I think this result may be controversial.

“Most of the community has been focused on finding dynamo action deep in the Sun.

“Now we’re showing there’s a different mechanism that seems to be a better match to observations.”