The extinction of the dinosaurs was caused by a perfect storm of colossal bad luck, according to new research.
The prehistoric creatures might have survived the asteroid strike which led to their extinction if it had come slightly earlier or later in history, scientists found.
But when the 10km-wide asteroid hit what is now Mexico some 66 million years ago they were experiencing environmental upheaval which left them vulnerable.
The new study by an international team of palaeontologists led by Edinburgh University looked at an updated catalogue of dinosaur fossils, mostly from North America.
They found that widespread volcanic activity, changing sea levels and varying temperatures had weakened the dinosaurs' food chain when disaster struck.
If the asteroid impact had come a few million years earlier, when the range of species was bigger and food chains more robust, they may have survived.
Likewise, if it had come later in history when new species had been given the chance to evolve, they might have escaped extinction.
But when the asteroid struck - causing tsunamis, earthquakes, wildfires, sudden temperature swings and other environmental changes - the already weakened dinosaur kingdom was wiped out one species after another.
The only dinosaurs to survive were those that could fly, which evolved to become the birds of today.