Bats are nature’s pest patrol. Every night the winged mammals venture forth from their caves and roosts to chow down on millions of insects, including some that plague farmers. But habitat loss and climate change, as well as infectious diseases such as white-nose syndrome, are hampering bats’ ability to do their job. A new study adds another item to the list: wildfires. But not too many—too few.

In California’s Sierra Nevada ecosystem, bats have adapted to occasional blazes. But a century of fire-suppression policies has kept some areas unburned for unusually long periods, resulting in denser forests with thicker undergrowth. “We wanted to see how these shifts in how fires are burning might be influencing bat biodiversity,” says University of California, Berkeley, ecologist Zack Steel, who conducted the research while a graduate student at the University of California, Davis.

Steel and his colleagues deployed an array of microphones to count bats by recording their distinctive echolocation chirps and squeaks over four years at six sites in the Sierra Nevada. Three of the areas had recently endured fires, and three remained unburned.

Seventeen bat species call these forests home. The study revealed that eight of them tended to frequent the unburned patches, whereas 11 used the burned areas (some species visited both). “We expected to see one group of species benefiting from fire—the more open-habitat-adapted species—and another group, the more clutter-adapted species, being negatively affected by fire, preferring the unburned areas,” Steel says. “But even some of those species were occurring more often in burned areas.”

What is ideal, the researchers write, is a combination of unburned areas and ones burned at different levels of severity—which they refer to as pyrodiversity. The results were published last December in the journal Scientific Reports.

“When there’s lots of variation in habitat after a fire, many species benefit in different ways,” says University of Connecticut biologist Andrew Stillman, who was not involved in the study. “On the whole, the community becomes more diverse, and that’s a good thing for the landscape.”

Extinguishing wildfires early leads to some species losing out on food and resources. “Fire is a natural part of the ecosystem, and many animals require the disturbance from fire to create the types of habitat that they need,” Stillman adds. “It demonstrates another negative consequence of keeping wildfire away from fire-adapted forests in California.”