The ability to regulate body temperature, a trait all mammals and birds have today, may have evolved among some dinosaurs around 180 million years ago, a study suggests.

Analysing 1,000 fossils, climate models, geography and how dinosaurs evolved, the new study looked at the spread of dinosaurs across different climates on Earth throughout the Mesozoic era (the dinosaur era lasting from 230 to 66 million years ago).

Researchers found that two of the three main groupings of dinosaurs, theropods (such as T. rex and velociraptor) and ornithischians (including relatives of the plant-eaters stegosaurus and triceratops), moved to colder climates during the Early Jurassic.

This suggests this is when the animals may have developed the ability to internally generate heat.

The findings also indicate that sauropods, including brontosaurus and the diplodocus, kept to warmer areas of the planet.

In the early 20th century it was thought that dinosaurs were slow-moving creatures that relied on heat from the sun to regulate their temperature.

While newer discoveries indicate some of the animals were likely capable of generating their own body heat, it is not known when this adaptation happened.

First author Dr Alfio Alessandro Chiarenza, of UCL Earth Sciences, said: “Our analyses show that different climate preferences emerged among the main dinosaur groups around the time of the Jenkyns event 183 million years ago, when intense volcanic activity led to global warming and extinction of plant groups.

“At this time, many new dinosaur groups emerged.

“The adoption of endothermy, perhaps a result of this environmental crisis, may have enabled theropods and ornithischians to thrive in colder environments, allowing them to be highly active and sustain activity over longer periods, to develop and grow faster and produce more offspring.”

Co-author Dr Sara Varela, of the Universidade de Vigo, Spain, said: “Theropods also include birds and our study suggests that birds’ unique temperature regulation may have had its origin in this Early Jurassic epoch.

“Sauropods, on the other hand, which stayed in warmer climates, grew to a gigantic size at around this time – another possible adaptation due to environmental pressure.

“Their smaller surface area to volume ratio would have meant these larger creatures would lose heat at a reduced rate, allowing them to stay active for longer.”

The new study is published in the journal Current Biology.