Jupiter's anomalous size and location in our Solar System has been puzzling researchers for years, since it doesn't fit with our understanding of planetary formation. Now, astronomers think they've figured out how the gas giant ended up in its curious position.

According to current models, giant planets form in the outer reaches of a system, migrate inwards, and end up very close to their star. Not Jupiter, though: a huge planet more than twice as massive as the rest of the Solar System planets combined, but orbiting pretty much in the thick of it.

The new research appears to have demystified Jupiter's history. According to computer simulations, the gas giant formed around four times farther out than its current location, just inside Uranus' current orbit, and slowly spiralled its way inwards over the course of 700,000 years.

"This is the first time we have proof that Jupiter was formed a long way from the Sun and then migrated to its current orbit," said astronomer Simona Pirani of Lund University in Sweden.

The research was based on asteroids called Trojans. These share Jupiter's orbit; one group of Trojans orbits in front of Jupiter, and the other trails behind it, in curved regions centring on the planet's Lagrange points.

trojans animated(Astronomical Institute of CAS/Petr Scheirich)

But there's a conundrum. The group in front of Jupiter contains roughly 50 percent more asteroids than the trailing group.

"The asymmetry has always been a mystery in the Solar System," said Lund University astronomer Anders Johansen.

So the team ran simulations of Jupiter's formation to figure out what might have caused such a strange imbalance.

They tested a variety of timeframes and even an outward migration pattern, and found that the scenario that results in the Trojan populations seen today occurs if Jupiter started its life as a planetary seed, an icy asteroid about 18 astronomical units from the Sun, about 4.5 billion years ago.

Within 2-3 million years, it would have started to migrate inwards to its current position of 5.2 astronomical units. This took roughly 700,000 years.

As it began this spiralling journey closer and closer to the Sun, drawn along by the gravitational force of gases lingering in the Solar System, the baby planet gravitationally picked up the Trojans, with more in the leading group than the trailing group.

This occurred before the planetesimal had accreted its gas; at that point, it was still accreting the rock that would collapse to form the planetary core, so it's also likely that Jupiter's core is made up of similar chunks of rock to that found in the Trojans, the researchers said.

Where Jupiter formed has been a problem that has long vexed planetary scientists, since it seems like gas giants can't form close to a star. The intense gravity, stellar radiation (including heat) and powerful stellar winds in close quarters would prevent the gas from staying together long enough to coalesce into a planet.

So, while this contradicts previous research predicated on the formation of Jupiter close to the Sun, followed by an outward migration, it also offers a solution - bringing Jupiter in line with what we understand based on observations of other planetary systems.

And, of course, if the team's simulations are correct, the asteroids could be a useful source for finding out previously unknown information about the gas giant.

"We can learn a lot about Jupiter's core and formation from studying the Trojans," Johansen said.

NASA is planning to launch a probe called Lucy to study them in October 2021, so we won't have to wait long to find out.

The research has been accepted into Astronomy & Astrophysics, and can be read on arXiv.