A new study has revealed how snakes owe their survival to the asteroid that wiped out the dinosaurs.

The impact wreaked havoc, wiping out most animals and plants. However, scientists claim that a few surviving snake species were able to thrive in a post-apocalyptic world by hiding underground and going without food for long periods of time.

The resilient reptiles then spread across the globe, giving rise to the 3,000 or so species that exist today.

Scientists from the University of Bath and collaborators from Bristol, Cambridge, and Germany used fossils and genetic differences between modern snakes to reconstruct snake evolution. The findings helped in determining when modern snakes first appeared.

Snakes were similar to the ones we know today when the asteroid slammed into Mexico: legless with stretchy jaws for swallowing prey.

With food in short supply, their ability to go without food for up to a year and hunt in the dark after the disaster was probably crucial to their survival.

The few snake species that survived were primarily those that lived underground or on the forest floor, as well as those that lived in freshwater.

They had a blank canvas to branch out along different evolutionary paths and across the world, colonizing Asia for the first time, with little competition from other animals.

Over the course of time, snakes become bigger and more widespread, exploiting new habitats, and new prey. New groups appeared, including giant sea snakes up to 10 meters long.

Only after this mass extinction did modern snake diversity emerge, including tree snakes, sea snakes, venomous vipers and cobras, and huge constrictors like boas and pythons.

Only a few times in the planet's history have such disasters occurred when at least half of all species die out in a relatively short period of time.

Evolution is "at its most wildly experimental and innovative", in the years following large extinctions, according to Dr. Nick Longrich of the Milner Centre for Evolution at the University of Bath.

Snakes are vital to ecosystem health because they keep prey in check and help humans by managing pests. Many species are threatened with extinction as a result of conflict with humans.

The study has been published in the journal Nature Communications.