The evolutionary secrets of a 230-million-year-old fossil reptile have been revealed, after a century of it being "locked inside a block of stone".
Researchers used powerful X-ray scans to examine the fossil, found a century ago in Scotland.
Their study produced the first full skeleton reconstruction of the creature Scleromochlus.
This small, scampering Triassic reptile is, scientists say, the ancestor of the great, winged pterodactyl.
The findings are published in the journal Nature.
Fossil of huge Jurassic flying lizard found in UK
Impact crater may be dinosaur killer's baby cousin
"We just didn't understand just how much we were missing until we did these scans," lead researcher Dr Davide Foffa, from National Museums Scotland, said.
Scleromochlus is part of a collection known as the Elgin reptiles - a set of fossils from the Triassic period unearthed in the 1900s in Lossiemouth, near Elgin, Moray.
They date to a time when Scotland was largely a desert within the supercontinent Pangea.
Dr Foffa and his colleagues worked closely with the Natural History Museum, in London, where much of the Elgin collection is now held, to scan and study seven fragile, sandstone-entombed specimens of Scleromochlus.
Until now, it has been difficult to draw useful information from the fossils. But they piqued the palaeontologist's interest because they date to a murky and critical point in the fossil record - about 10 million years before the first fossil pterosaurs.
"The first pterosaurs [we have] in the fossil record are already winged - already adapted for flying - so it's really difficult to understand where that came from," Dr Foffa said.
And now, fine anatomical details revealed by the X-ray scans - including the shape of its jaw and upper thigh bone - have allowed the scientists to correctly place Scleromochlus on the pterosaur family tree, revealing the first flying reptiles evolved from small ground-dwelling ancestors that probably ran around on two legs.
"It was great to be the first person to look at these details," Dr Foffa said.
"This animal now provides a lot of information about what the precursors of pterosaurs looked like."
Pterosaurs, more commonly called pterodactyls, were the first animals with bones to start flying, more than 200 million years ago, long before birds and bats took to the skies.
Prof Steve Brusatte from the University of Edinburgh, who was also involved in the study, described them as "bizarre" - with wings of skin attached to a single long, skinny finger.
"It's long been mysterious what type of animals they evolved from and how they took to the air," he told BBC News.
"By identifying Scleromochlus as a close pterosaur cousin, we can now reveal that pterosaurs evolved from tiny, fast-running, ground-living animals, which raced around on their toes like a ballerina, that were so humble that you could hold one in your hand."
Follow Victoria on Twitter.