Image copyright Dinghua Yang Image caption Dinocephalosaurus was adapted for a fully aquatic lifestyle

Scientists have uncovered the first evidence of live births in the group of animals that includes dinosaurs, crocodiles and birds.

All examples of this group, known as the Archosauromorpha, lay eggs.

This led some scientists to wonder whether there was something in their biology that prevented live births.

But examination of the fossil remains of a very long-necked, 245 million-year-old marine reptile from China revealed it was carrying an embryo.

Jun Liu, first author of the new study in Nature Communications, told BBC News that the animal would have measured between three and four metres long, with a neck that was about 1.7m long.

The embryo may have been around half a metre long and is positioned inside the rib cage of the adult Dinocephalosaurus fossil, which was discovered in 2008 in Luoping County, Yunnan Province in southern China.

Researchers had to consider whether the smaller animal might have been part of the adult's last meal. But it's facing forward, whereas swallowed prey generally face backwards because predators consume the animal head first to help it go down the throat.

Image copyright Jun Liu Image caption The fossil embryo appears to be facing forwards; ingested prey often end up facing backwards

Another line of evidence in favour of the live birth idea is that the small reptile inside the mother is clearly an example of the same species.

Co-author Prof Mike Benton, from the University of Bristol, told BBC News that the fossil was important because the Archosauromorpha form one of three large groupings of land-based vertebrates (backboned animals), each including about 10,000 species.

Since we now know that no fundamental biological barrier to live births exists in this group, palaeontologists would be "looking very closely" at other fossils. He suggested one target would be a group of aquatic crocodile relatives - whose mode of reproduction was not well known.

Prof Liu, from Hefei University of Technology in China, said the discovery pushes back evidence of reproductive biology in the archosauromorphs by 50 million years.

The mode of reproduction in Dinocephalosaurus also points to how the sex of its offspring was determined.

Image copyright Jun Liu Image caption The specimen was discovered at a site in Yunnan Province, southern China

Co-author Prof Chris Organ, from Montana State University, added: "Some reptiles today, such as crocodiles, determine the sex of their offspring by the temperature inside the nest.

"We identified that Dinocephalosaurus, a distant ancestor of crocodiles, determined the sex of its babies genetically, like mammals and birds."

Prof Benton explained: "This combination of live birth and genotypic sex determination seems to have been necessary for animals such as Dinocephalosaurus to become aquatic.

"It's great to see such an important step forward in our understanding of the evolution of a major group coming from a chance fossil find in a Chinese field."

The possibility that an eggshell once surrounded the embryo but was not preserved in fossilisation could not be ruled out, said Prof Benton. But living Archosauromorphs all lay eggs very early in embryonic development, whereas this embryo is very advanced, with well developed bones.

Furthermore, the team says Dinocephalosaurus's long neck and other features of its anatomy suggest it could not have manoeuvred easily out of the water, meaning a reproductive strategy like that of turtles - which lay eggs on land before returning to the water - was probably not an option.

Follow Paul on Twitter.