Travel back in time to 260 million years ago, just before the dawn of the dinosaur era. Journey to what is now South Africa, and make your way to a river bank. Then, wait. If you’re lucky, you might see a small, hand-sized creature poking its head out of the mud. It looks like a fat lizard, with bulging flanks and stocky legs. But if you managed to grab it and flip it over, you’d find that its flanks are bulging because its ribs are exceptionally wide, broad, and flat, reinforcing its undersides. It’s almost like the little creature has half a shell.

This is Eunotosaurus, and despite its lizard-like appearance, it’s actually one of the earliest known turtles.

It was discovered in 1892 and ignored for almost a century. But by studying the many fossils of this enigmatic reptile, Tyler Lyson from the Denver Museum of Nature and Science has devised a fascinating new idea about turtle origins. He thinks that their iconic shells evolved not for defense, but for digging. They anchored the powerful arm strokes needed to shift soil and sand. Before turtles became impregnable walking fortresses, they were professional burrowers.

For almost a century, biologists argued about how turtles got their shells—a debate almost as slow and plodding as the creatures themselves. Paleontologists mostly argued that the shells evolved from bony scales called osteoderms, which are also responsible for the armor of crocodiles, armadillos, and many dinosaurs. These scales simply expanded to fuse with the ribs and backbone, creating a solid covering. But developmental biologists disagreed. By studying modern turtle embryos, they deduced that the shell evolved from ribs, which broadened out and eventually united.

It didn’t help that for the longest time, the oldest known turtle was a creature called Proganochelys, which already had a fully developed (and very spiky) shell, meaning it couldn’t tell us anything about how that structure first arose.

Everything changed in 2008, when Chinese researchers discovered a 220-million-year-old turtle with a shell that covered just its belly and not its back. They called it Odontochelys semitestacea—literally, the “toothed turtle in a half-shell.” It was as beautiful an intermediate fossil as they could have hoped for. And strikingly, it had no osteoderms at all. It did, however, have very broad ribs. The developmental biologists were right!

Once paleontologists knew what one intermediate turtle might look like, they found new ones like Pappochelys. They also added existing fossils like Eunotosaurus to the family; ironically, it had been previously ruled out as an early turtle because it lacked osteoderms. With these fossils, scientists could reconstruct the evolution of the shell.

First, the lower ribs became wider and fused with each other to give half a shell—the plastron. Then, the upper ribs followed suit and merged with the spine, creating the carapace. (This means that, contrary to cartoons, you can’t pull a turtle out of its shell.) Eventually, through an intricate bit of evolutionary origami, the ribs started growing over the shoulder blades, rather than sitting below them as in you, me, and most other land-living vertebrates.

That takes care of how the shell evolved. “For me, the next question was: Why?” says Lyson. “And there are two huge reasons why not.”

First, the ribs and their associated muscles help to inflate and deflate the lungs. If you broaden and fuse your ribs, you compromise your ability to breathe. Second, if you’re a reptile, you also become slower. Reptiles have a sprawling gait, so they bend their bodies sideways to increase the length of their stride. They effectively walk with their entire trunks, which you can see in this video of a walking Komodo dragon. But wide fused ribs prevent trunks from bending, so turtles are powered only by their limbs. That’s partly why they’re famously slow. What benefit could a shell possibly provide that compensates for being worse at both breathing and walking?

“When I went to these turtle-specific conferences and I talked to people, they automatically said it was for protection,” Lyson recalls. “But that never made any sense.” Modern turtle shells certainly make for potent defenses,  but the wide ribs of Eunotosaurus and Pappochelys do not. They wouldn’t even have covered the creatures’ heads, necks, or backs. If protection was important, it would have made far more sense to follow crocodiles and armadillos down the osteoderm route, which wouldn’t have hampered breathing or walking.

So, to explain why the turtle shell evolved, you need to explain why they first started widening their ribs, despite the substantial costs of doing so. Lyson came up with a fresh answer by studying a large number of Eunotosaurus fossils. One specimen, which had been recently discovered by an eight-year-old South African boy, was especially important because it preserved the animal’s entire body, including its hands and feet.

Lyson noticed that Eunotosaurus had many distinctive features. It had a short, spade-shaped skull. Its hands were larger and sturdier than its feet. Its shoulder blades and forearms had large attachment points for especially buff triceps, all the better for pulling its arms back with extreme force. In short, it was built like a digger. Now the ribs made sense: they would have anchored the front legs as they scooped away at earth. They were excavation innovations.

Those same traits would also have made for a powerful swimmer, but Lyson found that Eunotosaurus has two features that digging requires but swimming does not: big claws for breaking up soil, and thickened bones for withstanding compressive forces. Indeed, when Lyson looked at its legs in cross-section, he found that the front pair was loaded with super thick bone, but the hind pair were not. Again, all the signs pointed to a burrowing specialist.

Eunotosaurus was often found near ponds and river banks, but lived at a time when South Africa was dry. Perhaps it burrowed to escape droughts, leaving the unpredictable environment on the surface for a more stable one beneath it. Its eyes support this idea. Another newly discovered specimen of Eunotosaurus has preserved sclerotic rings—bony circles that surround its eyes. By measuring these, Lyson deduced that the animal had small eyes that were likely insensitive to light. He interprets this as evidence of a life spent mostly underground.

That’s a stretch, says Jeanette Wyneken from Florida Atlantic University. “Sensitivity to light is largely a function of the retina and retinas are not preserved, which leaves me uneasy with the broad brush interpretation,” she says. But she’s more convinced by Lyson’s “compelling” take on Eunotosaurus’s limbs. “Will it further fuel debate? Undoubtedly.”

Eunotosaurus was clearly digging,” says Rainer Schoch from the State Museum of Natural History in Stuttgart. “The big question is whether the early turtles with partially formed shell—Pappochelys and Odontochelys—were too. This is important to know because they represent the stages in which the shell actually formed.” Lyson notes that these other turtles also had giant hands with long claws, although he’d need to study their cross-sections as he did with Eunotosaurus to really establish that they dug too.

Once turtles had their digging bodies—wider ribs and powerful front limbs—they could easily have taken to water, where many modern species still thrive. And they could expanded their ribs even further, adding defensive value. “Ribs are pretty boring,” says Lyson. “From snakes to whales, they’re pretty much the same because they’re so integrated with breathing. But once ribs were freed from that constraint, they could be selected for a shell.”

That would have been useful because the same adaptations that made early turtles good diggers also made them slow. “The selective pressure to develop protective structures may have come from the slower gait that resulted from the broader ribs,” says Judy Cebra-Thomas from Millersville University.

The turtle’s shell, then, is a wonderful example of exaptation—the evolutionary process where a trait evolves for one function and is then co-opted to serve another. They began as digging platforms and then became suits of armor. Feathers are another example. They now help birds to fly, but they probably originated as ways of keeping warm or signaling to mates and rivals.

“A change in a structure of the body can only provide a selective advantage based on its current abilities, not potential future ones,” says Cebra-Thomas. “That’s very important, and not just for understanding the evolution of turtles.”