The main sequence life of a star like the Sun may not end in a supernova like the most massive stars out there, but it will not be a quiet affair.

As the star runs out of fuel and becomes unstable, it puffs up to an absolutely enormous size before blowing off its outer material while the core collapses into a small, ultradense white dwarf.

For the Sun, that puffy red giant stage could extend as far as Mars, a process that could destabilize and destroy planets close enough.

We have seen white dwarf stars that have planets, suggesting that they can survive the process (or form after it). But, increasingly, scientists are finding that many exoplanets get eaten up by the white dwarf.

We can tell because of the 'pollution' by planetary elements in the atmospheres of white dwarf stars, the study of which is known as necroplanetology.

And now, astronomers have discovered the oldest known example: An exoplanet devoured by a white dwarf that formed 10.2 billion years ago.

The white dwarf is around 90 light-years from Earth, incredibly small and dim, with an unusual hue redder than any other white dwarf star. A second white dwarf star, unusually blue, formed 9 billion years ago. Both stars, the team found, are experiencing ongoing pollution by infalling planetary debris.

However, while the red star, named WD J2147-4035, represents the oldest polluted white dwarf discovered yet, the blue star, called WD J1922+0233, is potentially more interesting: The elements found in its atmosphere suggest the star is eating a planet very similar to Earth.

"We're finding the oldest stellar remnants in the Milky Way that are polluted by once Earth-like planets," says astrophysicist Abbigail Elms of the University of Warwick in the UK. "It's amazing to think that this happened on the scale of 10 billion years and that those planets died way before the Earth was even formed."

We can dissect the chemical composition of a star's atmosphere from the light produced by a star. Not all wavelengths are emitted equally: some are stronger, some are weaker. This is because elements can absorb and re-emit light, altering the spectrum of light emerging from the star.

It's not immediately apparent which elements are at play, but scientists are growing adept at identifying which absorption and emission features on a spectrum are associated with which elements.

When the European Space Agency's Gaia space observatory identified the two unusually colored white dwarfs, Elms and her colleagues subjected the two oddballs to various studies.

Since white dwarf stars are no longer powered by the fusion of elements in their core, their temperatures are slowly decreasing at a known rate; by taking the two stars' temperatures, researchers were able to gauge how long since they formed from the death of a Sun-like star.

Next, they subjected the stars' spectra to analyses to determine their atmospheric compositions. On the red star, they found sodium, lithium, potassium, and possibly carbon. On the blue star, they found sodium, calcium, and potassium.

Since white dwarfs are so gravitationally intense, heavy elements like these should disappear into the white dwarf's interior, beyond detection, very quickly; this suggests that the material producing these elements is still falling onto the stars from debris clouds around them.

In the case of WD J2147-4035, the team determined that the pollution was probably the remains of a planetary system that had orbited the star before it died, survived the stellar death throes, and is now slowly, over billions of years, falling into the star.

Since the star turned into a white dwarf more than 10 billion years ago, this makes it the oldest known planetary system in the Milky Way (albeit a disintegrating and disappearing one).

Meanwhile, the debris polluting WD J1922+0233 has a similar composition to Earth's continental crust, suggesting an Earth-like planet orbiting a Sun-like star that lived and died billions of years before the Solar System formed.

It's like a fossil record of the galaxy that can tell us what planetary systems in the Milky Way were like in the eons before we arrived here to marvel at its wonders.

"When these old stars formed more than 10 billion years ago, the universe was less metal-rich than it is now since metals are formed in evolved stars and gigantic stellar explosions," says astrophysicist Pier-Emmanuel Tremblay of the University of Warwick.

"The two observed white dwarfs provide an exciting window into planetary formation in a metal-poor and gas-rich environment that was different to the conditions when the Solar System was formed."

The research has been published in the Monthly Notices of the Royal Astronomical Society.