Huge meat-eating, land-living dinosaurs evolved into birds by constantly shrinking for over 50 million years, scientists have revealed.
Theropods shrunk 12 times from 163kg (25st 9lb) to 0.8kg (1.8lb), before becoming modern birds.
The researchers found theropods were the only dinosaurs to get continuously smaller.
Their skeletons also changed four times faster than other dinosaurs, helping them to survive.
Results from the study are reported in the journal Science.
Previous work has shown that theropod dinosaurs, the dinosaur group which included Tyrannosaurus rex and Velociraptor and gave rise to modern birds, must have decreased in size at some point in their evolution into small, agile flyers.
But size changes frequently occurred in dinosaur evolution, so the research team members, led by Mike Lee, from the University of Adelaide, Australia, wanted to find out if the dramatic size reduction associated with the origin of birds was unique.
They also wanted to measure the rate of evolution in dinosaurs using a large data set.
The authors used sophisticated analytical tools - developed by molecular biologists trying to understand virus evolution - to study more than 1,500 dinosaur body traits coded from 120 well-documented species of theropod and early birds.
From this analysis they produced a detailed family tree mapping out the transformation of theropods to their bird descendants.
It traces evolving adaptations and changing body size over time and across dinosaur branches.
They found that the dinosaur group directly related to birds shrank rapidly from about 200 million years ago.
It showed a decrease in body mass of 162.2kg (25st 7lb) from the largest average body size to Archaeopteryx, the earliest known bird.
These bird ancestors also evolved new adaptations, including feathers, wishbones and wings, four times faster than other dinosaurs.
The researchers concluded that the evolution of the branch of dinosaurs leading to birds was more innovative than other dinosaur lineages.
The authors say this sustained shrinking and accelerated evolution of smaller and smaller body size allowed the ancestors of birds to develop traits which helped them to cope much better than their less evolved dinosaur relatives.
'Birds evolved through a unique phase of sustained miniaturisation in dinosaurs,' Mr Lee said.
'Being smaller and lighter in the land of giants, with rapidly evolving anatomical adaptations, provided these bird ancestors with new ecological opportunities, such as the ability to climb trees, glide and fly.
'Ultimately, this evolutionary flexibility helped birds survive the deadly meteorite impact which killed off all their dinosaurian cousins.'
'No overnight transformation'
The researchers believe that miniaturisation and the development of bird-like traits had a joint influence on the evolution of the dinosaurs into today's birds.
Professor Michael Benton, from the University of Bristol's school of earth sciences, said: 'This study means we can't see the origin of birds as a sudden or dramatic event, with a dinosaur becoming a powered flyer overnight.
'The functions of each special feature of birds changed over time - feathers first for insulation, and later co-opted for flight; early reductions in body size perhaps for other reasons, and later they were small enough for powered flight; improvements in sense of sight and enlargement of brain - even a small improvement in these is advantageous.
'So perhaps it's a long-term trend associated with deputation to a new set of habitats, in the trees, to avoid predation, and to exploit new food resources.'
Join BBC Nature on Facebook and Twitter @BBCNature.