Image caption The sea turtle's unique shell evolved many millions of years ago

How the turtle shell evolved has puzzled scientists for years, but new research sheds light on how their hard shells were formed.

Scientists say the ancient fossil skeleton of an extinct South African reptile has helped bridge a 30 to 55-million-year gap.

This ancestor of the modern turtle, Eunotosaurus, is thought to be around 260 million years old.

It had significant differences to a recently found fossil relative.

Eunotosaurus was discovered over a century ago but new research in the journal Current Biology has only now analysed its differences to other turtle fossils.

Image caption An extinct reptile fossil has helped scientists discover how turtles hard shells are formed

A turtle's shell is unique in that it is made up of around 50 bones, with ribs, shoulder bones and vertebrae fused together to form a hard external shell.

How it forms today can be observed in a developing turtle embryo. Ribs broaden first followed by the broadening of vertebrae. The final state is the development of an outer layer of skin on the perimeter of the shell.

"The turtle shell is a complex structure whose initial transformations started over 260 million years ago in the Permian period," said lead author of the study, Dr Tyler Lyson from the Smithsonian Institution and Yale University.

"The shell evolved over millions of years and was gradually modified into its present-day shape."

A turtle fossil 210 million years old had a fully developed shell similar to those today, but 10 million years earlier, a fossil discovered in China, named Odontochelys semitestac, had an incomplete top shell, called a carapace.

This fossil has now helped Dr Lyson and colleagues compare the modern turtle with its ancestor Eunotosaurus.

Like turtles today, Eunotosaurus had nine pairs of T-shaped ribs. This ancient creature however did not have broad spines on its vertebrae, which both Odontochelys and modern-day turtles do have.

It also lacked intercostal muscles, which are the group of muscles that run between the ribs, and did not have osteoderms - bony scales.

A turtle's shell The shell's main function is protection but it can also help a turtle live underwater for longer than any other vertebrate

This is because it stores potassium and magnesium which can help protect it from a build up of lactic acid

Other animals such as armadillos or various lizards, all form a shell via the acquisition of more and more osteoderms (ossified scales) Explore more reptiles on BBC Nature

"Eunotosaurus is a good transitional fossil which bridges the morphological gap between turtles and other reptiles," said Dr Lyson.

The evidence between fossil and developmental data shows that first the ribs broadened, then the neural spines of the vertebrae broadened, and finally osteoderms on the outer side of the shell formed. These all sutured together to form the modern-day turtle shell, he added.

"One of the direct consequences of forming a protective shell by broadening and locking their ribs is that turtles cannot use their ribs to breathe.

"Instead turtles have developed a unique abdominal muscular sling that wraps around their lungs and organs to help them breathe."

Image caption A living South African sideneck turtle next to its 260-million-year-old relative, Eunotosaurus africanus

Judith Cebra-Thomas, assistant professor from the department of biology at Millersville University in Pennsylvania, who was not involved with the study, said the research was very important in terms of understanding the turtle shell's evolution.

"The turtle shell is considered an evolutionary novelty, which means that there are no closely analogous structures in related animals.

"That leads to the notion that such things cannot occur through normal evolutionary processes. But, when you examine it in detail, you can see the series of steps, each of them explainable through small changes that gradually add up to the novel structure."