Sixty six million years ago, life on Earth had a very bad day.

That’s when an immense asteroid slammed into what is now the Yucatan Peninsula, triggering one of the worst extinction crises of all time. This, of course, was the disaster that wiped out the dinosaurs. But it wasn’t just the “terrible lizards” who were lost. The world also saw the last of the coil-shelled squid cousins called ammonites, seagoing lizards called mosasaurs, and myriad other forms of life—including the strange, sometimes massive, flying pterosaurs.

Pterosaurs, as any paleontologist or 10-year-old will tell you, are not dinosaurs. Yet because of the name—and because they can also be massive and ferocious looking—these leathery-winged reptiles are often confused for their distant cousins. In reality, pterosaurs have their own, independent evolutionary history going back to over 220 million years ago. Nor are they related to today's flying dinosaurs, which we call birds.

Pterosaurs were the first vertebrates to evolve powered flight, adapting to the skies long before birds would do the same. Masters of the Mesozoic skies, they flapped on wings composed of skin stretched out to meet the end of a ludicrously-elongated fourth finger. They ranged in size from fliers the size of a sparrow to giants like Quetzalcoatlus, a truly imposing saurian that would stand as tall as a giraffe when on the ground.

But what happened to these formidable fliers? Even though the last of the pterosaurs vanished at the same time as the likes of Tyrannosaurus and Triceratops, considerably less attention has been paid to their demise. Scientists agree that the same ecological consequences that cut down the non-avian dinosaurs must have killed the last pterosaurs as well.

“There is broad agreement that the cause of the dinosaur and pterosaur extinctions were one and the same,” University of Texas, Austin paleontologist Brian Andres says. The aftermath of the asteroid impact is the large scale reason for both. But the question on the mind of pterosaur researchers, Andres says, is whether pterosaurs were in decline before the impact or not.

A new discovery helps researchers begin to answer that question. Based on new finds in Morocco, Andres and colleagues report, we can say pterosaurs were still going strong until the very end.

This change has been building discovery by discovery. For years, says University of Southampton pterosaur expert Elizabeth Martin-Silverstone, paleontologists thought that there was just one group of pterosaurs left at the end of the Cretaceous, immense fliers called azhdarchids. But in recent years, pterosaur researchers have identified rare members of other groups in rocks of the same age. So while pterosaurs were “maybe less diverse than they were at their height,” Martin-Silverstone says, they were still “doing better than we initially appreciated.”

These fossiliferous tidbits have been hard-won. To read the story of a mass extinction, scientists need two things: the rocks that record the time just before the catastrophe, and the rocks from just after. In the case of pterosaurs, paleontologists have narrowed their search to the rocks dated to the latest Cretaceous and the earliest Paleocene, the extinction itself dividing these before-and-after snapshots of what transpired.

From a smattering of fossils found in the late Cretaceous rock of Morocco, Andres and colleagues have identified seven species of pterosaur—one familiar, and six new to science—belonging to three different families. These Moroccan pterosaurs nearly double the number of pterosaurs known at the end of the Cretaceous.

Perhaps more fascinating, most of these pterosaurs made their living flying along and over ancient oceans. “Up until now,” Andres says, “the majority of Late Cretaceous pterosaurs were found in inland paleoenvironments. We had no idea that there were so many ocean-going pterosaurs at their end.” Rather than dwindling, pterosaurs were thriving.

There are several reasons why researchers missed this pterosaur treasure trove. To start with, the fossil record is woefully incomplete. It can be challenging to pinpoint the places where sought-after fossils might be found, and even then, the fossils are rare. Pterosaurs are especially elusive, as the constraints of flight required that they were supported on thin, fragile bones that don’t preserve well. Add the fact that science is a human endeavor directed by ever-changing research interests, and it’s no wonder that experts continue to dig up surprises.

But the realization that pterosaurs held on to their ecological perch until the very end only deepens the mystery of their fate. They were not in a slow decline, but were suddenly and irrevocably erased while other fliers—namely, birds—arced to triumph.

Size, it turns out, might have made the difference. Pterosaurs lived at a huge range of body sizes, but by the end of the Cretaceous most were quite large. “A small pterosaur still had a wingspan of one and a half to two meters [4.9 to 6.6 feet],” Martin-Silverstone says, which was about the size of the larger birds at the time.

Living that large may have made pterosaurs more vulnerable to extinction. “As in any revolution,” Andres says, “the ‘large and in charge’ are the first against the wall, and all groups lost their largest species in the K/Pg extinction.”

Not that the pterosaur die-off is that simple. Most late Cretaceous pterosaurs were large, Martin-Silverstone says, but not all. So why weren’t the small ones able to recover? “Maybe there were just not enough small ones to diversity after the impact,” Martin-Silverstone says. Or perhaps feeding habits made the difference. Another study, published in 2016, suggested that avian dinosaurs survived their relatives because they were small seed eaters and better able to cope with the available produce in the wake of the extinction. The same reasoning might explain why, despite both being capable of flight, birds lived while pterosaurs perished.

There’s another way to look at this, though. We can examine the extinction event and ask why pterosaurs didn’t survive, Andres says. Or we can look at the aftermath, and what happened once birds were the primary fliers around. The fact that pterosaurs were large, and may have prevented birds from achieving comparable sizes, may have forced birds to inadvertently evolve in ways that would give them an advantage under pressure.

“By preventing birds from evolving larger sizes, Andres says, “the pterosaurs may have saved the birds from extinction.” So the next time you see a Steller’s jay at the feeder or chickadee on the street—you might want to thank a pterosaur.