The footprints of a mysterious reptile that lived about 250 million years ago have been identified in the Pyrenees mountains.
Scientists say the new species is a member of the group that gave rise to crocodiles and dinosaurs.
The reptile lived at a time when the Earth was recovering from a mass extinction that wiped out most animals.
The discovery may shed light on how the group of animals evolved and spread.
About 252 million years ago, a mass extinction devastated life on land and in the oceans. Some 90% of species disappeared.
At the time, the Earth was very different from today, with continents grouped into the supercontinent, Pangaea.
Researchers led by Eudald Mujal of Universitat Autònoma de Barcelona, Spain, examined fossilised footprints from about 247 to 248 million years ago found in the Pyrenees mountains in Catalonia.
They found most tracks were made by the ancestors of crocodiles and dinosaurs, a group known as archosauromorphs.
Most of the reptiles were small, about half a metre in length, although a few were longer than three metres.
Among them was the footprint of what is thought to be a new species of reptile, Prorotodactylus mesaxonichnus.
The makers of the footprints could belong to the Euparkeria, a group of dinosaur relatives known from the same time period in Poland, Russia, China and South Africa.
Co-researcher Josep Fortuny of the Institut Català de Paleontologia Miquel Crusafont said the footprints suggest the animals, measuring around half a metre, used all four limbs to walk and often also left marks with their tails.
"Some footprints point to the possibility of bipedal locomotion in specific moments with the aim of moving faster," he said.
The researchers think archosauromorphs dominated the river beds of the ancient Pyrenees.
The group may have been key to the recovery of ecosystems after the extinction, going on to spread across the supercontinent.
"These tracks represent the first evidence of the vertebrate recovery of the End-Permian extinction," Eudald Mujal told BBC News.
He said the search was underway for fossilised bones of the animals that made the tracks.
The research is published in the journal, PLOS ONE.
Follow Helen on Twitter.