When a star like our Sun is close to death, it expands to an enormous size to become a red giant star, swallowing all in its path 鈥 and spelling doom for nearby planets.

But astronomers have discovered a planet that seems to have done the impossible: survived, despite evidence of a celestial event that should鈥檝e destroyed it.

A paper published Wednesday in the describes the discovery of the unusual past of a Jupiter-like gas giant called Halla and the red giant star it orbits, Baekdu.

Halla, also known as 8 Umi b, orbits Baekdu at about half the distance that separates the Earth from our Sun.

It was first discovered in 2015 by astronomers from Korea, who detected its gravitational pull on the star using the radial velocity method, which works by measuring the wobble of a star to track whether something might be orbiting it.

But in this new study, astronomers from the University of Hawai鈥檌 Institute for Astronomy discovered that the planet鈥檚 existence doesn鈥檛 exactly track with the development of the star it orbits.

Using observations gathered by NASA鈥檚 Transiting Exoplanet Survey Satellite (TESS), astronomers found that Baekdu contains burning helium at its core, a sign that this star had already expanded hugely in the past, an expansion which would鈥檝e included the orbital path that Halla currently is on, before Baekdu settled down into its current size.

Before this discovery, the lack of planets closely orbiting red giant stars led astronomers to believe that planets are unable to survive the process of stars expanding into red giants.

But Halla is definitely there 鈥 this new data confirms the presence of the planet.

Astronomers double checked using additional observations from Keck Observatory鈥檚 High-Resolution Echelle Spectrometer and other tools, and found that Halla鈥檚 93-day orbit is as stable as it has been for a decade and that the gravitational pull on Baekdu can鈥檛 be explained by anything other than a planet.

鈥淭ogether, these observations confirmed the existence of the planet, leaving us with the compelling question of how the planet actually survived,鈥 Daniel Huber, an astronomer with the University of Hawai鈥檌 Institute for Astronomy and an author of the study, 鈥淭he observations from multiple telescopes on Maunakea was critical in this process.鈥

So if the planet is orbiting the star at a distance that means it should鈥檝e been engulfed in a massive expansion countless years ago, how did it survive?

Astronomers have a few theories. One is that the planet may have crept closer to the star as time went on and that it had a larger orbit in the past that allowed it to escape the expansion path of the star. However, this isn鈥檛 the most likely case, astronomers say.

Another theory is that Baekdu may once have been two stars and Halla was orbiting both of them when they merged. The merging of the two stars would鈥檝e kept any expansion contained to a smaller degree, which could鈥檝e meant Halla got out unscathed.

The possibility of a binary star system merging into one leads into the third theory, which is that Halla is actually a newer planet than previously thought.

It could be that the two stars collided with each other, producing a gas cloud that gave way to Halla鈥檚 formation.

鈥淢ost stars are in binary systems, but we don鈥檛 yet fully grasp how planets may form around them. Therefore, it鈥檚 plausible that more planets may actually exist around highly evolved stars thanks to binary interactions,鈥 Marc Hon, a NASA Hubble Fellow at the University of Hawai鈥檌 Institute for Astronomy and leader of the team, explained in the press release.