Scientists for the first time have spotted the insides of a dying star as it exploded, offering a rare peek into stellar evolution.

Stars can live for millions to trillions of years until they run out of fuel. The most massive ones go out with a bang in an explosion called a supernova.

Using telescopes that peer deep into space, researchers have observed many such explosions. The cosmic outbursts tend to jumble up a dying star's layers, making it hard for scientists to observe the inner structure.

But that wasn't the case for the new discovery, a supernova called 2021yfj located in our Milky Way galaxy.

The collapsing star's outermost layers of hydrogen and helium had peeled away long ago, which wasn't surprising. But the star's dense, innermost layers of silicon and sulfur had also shed during the explosion.

The finding lends evidence to ideas scientists have about how large stars look near the end of their lives, organized into layers with lighter elements on the outside and heavier ones close to the core.

It's not yet clear how this star got so whittled down — whether its layers were flung off violently in the final stages of its life or yanked away by a twin star. Future research may yield clues, though scientists acknowledged such an event may be tough to capture again.

The Associated Press Health and Science Department receives support from the Howard Hughes Medical Institute’s Department of Science Education and the Robert Wood Johnson Foundation. The AP is solely responsible for all content.