Imagine you’re a small mammal of the Mesozoic. Snuffling around one day, you run into a cat-size, scaly, big-eyed reptile that looks not unlike a crocodile found later in the 21st century. Spotting you, he opens his mouth wide to reveal … tiny, intricate teeth. Then he turns his head and munches on some leaves.

Such encounters may have been common in prehistory. Research published Thursday in Current Biology suggests that vegetarianism evolved at least three separate times in ancient crocs — a conclusion reached after scientists studied the unusual teeth sported by many species, including the Simosuchus described above.

[Like the Science Times page on Facebook. | Sign up for the Science Times newsletter.]

Today, crocodiles and their relatives, among them alligators, caimans and gharials, can be found across the Southern hemisphere. They have many things in common, including meat-heavy diets, a penchant for swimming and their teeth. Ask them to smile for a family reunion photo, and each mouth would bristle with simple, blunt-tipped cones.

But the Mesozoic was a different story. About 250 million years ago, scores of crocodyliform species could be found across the globe, some on land and some in seas and rivers. A particular species might eat only plants, only animals, or both. To support these varied diets, many had “unique, interesting teeth,” said Keegan Melstrom, a geobiology graduate student at the University of Utah and lead author of the new study.