As far as dead bugs go, we’d venture to say this is one of the fanciest in the history of Earth.

Last year, gemologist Brian Berger was attracted to an exceptionally gorgeous opal at a market on the island of Java in Indonesia. While it was the gemstone’s vibrant colors that first caught his eye, he quickly realized the opal also featured an insect that had, somehow, become trapped inside.

"As evidenced in the photos, you can see what appears to be a complete insect encased beautifully inside," Berger wrote in a blog post for Entomology Today. "Upon close inspection, the insect appears to have an open mouth and to be very well preserved, with even fibrous structures extending from the appendages."

In all likelihood, this super-rare specimen started as an insect that became swamped in tree resin. Over the millennia, subjected to high pressures and temperatures beneath layers of sediment, the resin then turned into amber. This process alone takes millions of years and requires numerous specific circumstances, especially if the resin contains organic material.

While insects encased in amber are well known and plentiful, this was then followed by a second process called opalization, enriching the gemstone with a distinctive iridescent rainbow coloring. Remarkably, the structure of the unknown insect remains intact and clearly visible.

Scientists don’t know too much about how opals are formed, but the process of opalization generally involves turning matter into a silica mineral by combining silicon dioxide with water. It can occur to wood, rocks, shells, and even fossilized dinosaur bones. For example, “Eric the Pliosaur” is a rather awesome opalized fossil of a prehistoric aquatic reptile.

As you can imagine, it’s incredibly uncommon for the formation of amber and opalization to both occur to the same chunk of ancient tree resin (that just so happened to also contain a bug too). In fact, this is believed to be among very few known examples of this ever happening. To ensure that the stone was not a fake, Berger sent it for an examination at the Gemological Institute of America, who verified its provenance and noted it's the only one they have ever examined.

"As far as value on the specimen, it’s truly priceless to me," Brian told IFLScience. "I don’t think at this point it’s for sale, but I am considering offering it to a museum for display if there is interest, as I feel like sharing the discovery with the world is probably the best route.“

Updated 25/01/2019 with comments from Brian Berger