A newly discovered 250-million-year-old fossil reptile from Brazil gives an "extraordinary" insight into life just before the dinosaurs appeared.
At the time, the world was recovering from a massive extinction that wiped out most living species.
The reptile, named Teyujagua or "fierce lizard", is the close relative of a group that gave rise to dinosaurs, crocodiles and birds.
The animal is a new species that has not been previously known.
"It's very close to the ancestry of a very important group of reptiles called archosauriforms," said Dr Richard Butler, who was the co-researcher on the study published in the journal Scientific Reports.
"It helps us understand how that group evolved."
Teyujagua paradoxa was a small crocodile-like animal that probably lived at the side of lakes, feeding on fish.
The ancient reptile lived just after a mass extinction event 252 million years ago that was thought to have been triggered by a string of volcanic eruptions.
About 90% of living species were lost, creating a gap for other animals, such as Teyujagua, to flourish.
The reptile - and its close relatives the archosauriforms - became the dominant animals on land and eventually gave rise to the dinosaurs.