Dinosaurs were struggling to survive millions of years before a meteor impact wiped them out.
That's the finding of a new study, which the authors claim puts to bed the debate about the state of the dinosaur population as a whole before they all died.
For decades, scientists have debated whether dinosaurs had been in a long-term decline before they met their end or whether they were at the peak of their reign.
A lack of data has prevented resolution, but the study, published in the Proceedings of the National Academy of Sciences, provides "overwhelming" evidence the dinosaurs were dying a slow death.
A statistical approach was taken to look at changes in speciation -- the process in which populations become distinct species -- and extinction over time.
It found all three major dinosaur groups were experiencing a slow decline tens of millions of years before what is known as the Cetaceous-Paleogene mass extinction, thought to have killed three-quarters of the plant and animal species on Earth.
There was a marked reduction in their ability to replace extinct species with new ones, which made them vulnerable to extinction, and they couldn't recover fast enough from a meteorite impact in modern-day Mexico 66 million years ago.
The long-necked herbivore sauropod dinosaurs like the brontosaurus were found to have been dying out fastest, while theropods -- including the Tyrannosaurus rex -- were disappearing more gradually.
The break-up of continental land masses and volcanic activity were potentially factors in the dinosaurs' struggle to survive, the study says.
The final blow for the dinosaurs was the giant asteroid which hit Chicxulub, leaving a crater more than 180km in diameter and 20km deep.