An artist's impression of a giant space rock slamming into Earth 65 million years ago near what is now Mexico's Yucatan Peninsula.

The cataclysm that ended the Age of Dinosaurs not only drove land animals to migrate into the water, but also pushed aquatic creatures to colonize the land, a new study reveals.

The shifts between land and water in the animal kingdom are among the most pivotal in evolution. The most famous example is that of fish that made the switch from water to land — the first tetrapods, or four-legged animals, which gave rise to amphibians, reptiles, birds and mammals. Animals also moved from land to water — for example, the ancestors of seafaring whales appear to have been deerlike ungulates, or hoofed mammals.

Scientists reason the shifts between the aquatic and terrestrial realms might relate to environmental upheaval. For instance, mass extinctions usually leave many open roles within ecosystems, niches that survivors might evolve to fill. [Wipe Out! History's 7 Most Mysterious Mass Extinctions]

To investigate these shifts, researchers looked at the aftermath of the most recent cataclysm, the end-Cretaceous mass extinction about 65 million years ago that ended the dominance of the dinosaurs on Earth. The researchers focused on the family trees of existing tetrapods — amphibians, reptiles, birds and mammals — examining when lineages of animals within those family trees began diverging from one another.

A fleshed-out reconstruction of the early tetrapod Ichthyostega. The flesh is semi-transparent so the skeleton is visible underneath. (Image credit: Julia Molnar)

The scientists demonstrated the end-Cretaceous mass extinction was instrumental to the emergence of tetrapod lineages that shifted between the realms of land and water, either in terms of where they fed as adults or where they developed when young. The study revealed five lineages that shifted from land to water and eight that moved from water to land, all occurring after the end-Cretaceous mass extinction.

Examples of shifts from land to water include "cetaceans — whales and dolphins — together with their relatives the hippos, [evolving] from terrestrial ungulates," said lead study author Serban Proches, a naturalist at the University of KwaZulu-Natal in South Africa. Other examples include ducks from land birds, and "some fully aquatic legless amphibians from typically amphibious ones," Proches noted.

Cases of shifts from water to land include the emergence of tortoises from turtles and terrapins, and "several fully terrestrial frog lineages from typical amphibious ones," Proches told Live Science.

The researchers had expected to find "lots of land-to-water transitions following the end-Cretaceous extinction," Proches said. "This was the time when life on land was becoming more diverse than life in the sea. We thought we'd see the land pouring animals into the sea."

Finding so many animals shifting from water to the land surprised the investigators. The number of such shifts could be due to how widespread aquatic lineages of animals were — "they were more likely to find a suitable piece of land to move onto, in terms of available niches, somewhere within their geographic range," Proches said.

Proches and his colleagues noted their analysis left out animal groups that had fewer than 10 living species. This means that the findings exclude very recent transitions that have had little opportunity to branch out into many species. Still, the pattern of shifts between realms associated with the end-Cretaceous mass extinction remains clear, they said.

The scientists detailed their findings online June 11 in the journal Biology Letters.

Follow us @livescience, Facebook & Google+. Original article on Live Science.