Astronomers have found a bizarre asteroid orbiting the sun in the wrong direction while playing a risky game of "chicken" with the largest planet in the solar system.

The unnamed asteroid shares Jupiter's orbital space while moving in the opposite direction as the planet, which looks like a recipe for a collision, astronomers said. Yet somehow, the asteroid has managed to safely dodge Jupiter for at least tens of thousands of laps around the sun, a new study showed.

This mysteriously lucky asteroid was discovered in 2015 by astronomers using the Panoramic Survey Telescope and Rapid Response System (Pan-STARRS1) in Hawaii. It was given the provisional designation 2015 BZ509 with the nickname "BZ." Scientists noticed that the asteroid moves in the opposite direction of every planet and 99.99 percent of asteroids orbiting the sun, in a state known as retrograde motion.

While BZ appeared to be encroaching on Jupiter's orbit, researchers said they needed to observe the asteroid further to confirm their suspicion. The team, led by Paul Wiegert of Western University in Ontario, Canada, began tracking BZ using the Large Binocular Telescope (LBT) at the Mount Graham International Observatory in Arizona. From the new observations they made, the researchers confirmed that the rare, retrograde asteroid does indeed co-orbit Jupiter.

Other asteroids are known to orbit in retrograde, making the backwards motion by itself "unusual but not unique," Wiegert said in a statement. "The stranger thing is that BZ is also playing a cosmic game of 'chicken' with the giant planet Jupiter," he added. "The other retrograde asteroids tend to remain away from the planets."

This image of asteroid 2015 BZ509, captured by the Large Binocular Telescope Observatory (LBTO), helped astronomers establish the object's retrograde, co-orbital nature. (Image credit: LBTO)

About 6,000 asteroids share Jupiter's orbital path. Known as Trojan asteroids, they tend to cluster into two groups orbiting ahead of and behind Jupiter at the planet's two stable Lagrange points, located about 60 degrees ahead and 60 degrees behind Jupiter along its path around the sun. Because these asteroids orbit the sun in the same direction as the planet, called prograde motion, they won't collide with Jupiter, Wiegert said. BZ, on the other hand, makes a close call with every orbit, buzzing dangerously close to the gas giant.

"This is not what one would expect to be a very long-lived situation, but this study shows that BZ has done so safely for at least tens of thousands of 'laps,' avoiding [Jupiter] by weaving in and out of the planet's path every time they pass," Wiegert said. "2015 BZ509 is the first asteroid known to have this relationship with any of the planets. Calculations show it will continue to safely navigate its unusual path for the next million years at least." [The 7 Strangest Asteroids in the Solar System]

BZ may seem like a lucky asteroid, narrowly dodging its own demise over and over for such a long time. But surprisingly, Jupiter's gravity has played a big role in helping the asteroid to avoid such a collision, Wiegert said.

"BZ passes once inside and once outside Jupiter each time they orbit the sun, and the two gravitational tugs that Jupiter gives the asteroid cancel out, giving BZ opposing 'nudges' that keep it on track," Wiegert said. "Ironically, BZ would be more likely to crash into Jupiter if that planet had no gravity at all, because without the gravitational nudges, [the asteroid] would gradually drift out of sync with that planet."

The results of the study were published online today (March 29) in the journal Nature.

Email Hanneke Weitering at hweitering@space.com or follow her @hannekescience. Follow us @Spacedotcom, Facebook and Google+. Original article on Space.com.