The birds that live on Earth today have all descended from dinosaurs, the creatures who dominated the planet for a couple of hundred million years, before an asteroid impact caused their extinction. It turns out birds at the time, better called avian dinosaurs, nearly got plucked too, with only those species that lived on the ground surviving the Cretaceous-Paleogene (K-Pg) mass extinction event.

Some 66 million years ago, when an asteroid (now called the Chicxulub impactor, for the crater it left behind near the eponymous town in present-day Mexico) crashed into Earth, it led to sudden and severe changes in the climate worldwide, other than the immediate deathly impact on most life in a very large adjoining area, up to a few thousand miles away. Those changes together led to the death of about 75 percent of all animal and plant life on Earth.

It was commonly thought that avian dinosaurs survived the mass extinction event, and later evolved into birds. But new research suggests that forests on the planet’s surface also disappeared at the time, taking away the habitat of arboreal avian dinosaurs, who died along with the rest of their non-flying kin. It was only those early birds that lived on the ground that survived, taking to trees again once they recovered hundreds or thousands of years later.

“We drew on a variety of approaches to stitch this story together. We concluded that the devastation of forests in the aftermath of the asteroid impact explains why tree-dwelling birds failed to survive across this extinction event. The ancestors of modern tree-dwelling birds did not move into the trees until forests had recovered from the extinction-causing asteroid,” the study’s lead author Daniel Field of the Milner Centre for Evolution at the University of Bath, in the United Kingdom, said in a statement Thursday.

The researchers arrived at this conclusion by studying the ecological habits and evolutionary relationships of extant birds, and drawing up an evolutionary history. They surmised that the most recent common ancestor of all birds still living quite likely lived on the ground, and not in trees. That species would have been in the minority at the time of the K-Pg mass extinction event.

“Today, birds are the most diverse and globally widespread group of terrestrial vertebrate animals — there are nearly 11,000 living species. Only a handful of ancestral bird lineages succeeded in surviving the K-Pg mass extinction event 66 million years ago, and all of today’s amazing living bird diversity can be traced to these ancient survivors,” Field said.

The force of the impact of the asteroid could be compared to a million times that of the largest atomic bomb made by humans. It probably led to volcanic eruptions and burning material in several places around Earth, which would have started massive forest fires. So it is no surprise trees would disappear.

“Looking at the fossil record, at plants and birds, there are multiple lines of evidence suggesting that the forest canopies collapsed. Perching birds went extinct because there were no more perches,” Regan Dunn, a paleontologist at the Field Museum in Chicago and a coauthor on the study, said in another statement.

The paper was published online Thursday in the journal Current Biology under the title “Early Evolution of Modern Birds Structured by Global Forest Collapse at the End-Cretaceous Mass Extinction.”