Trees, some of the tallest in the world, towered above Hannah Griffiths and her colleagues each morning as they tramped deep into a pristine patch of rainforest in the Maliau Basin in Borneo. Birds sang and wildlife ambled across their paths. One day, a sun bear skittered across the path in front of them. Another day, a king cobra slithered by.

But the scientists walked past, crossing suspension bridges and pushing deeper into the forest, where they had set up a set of experiments to look at the ecological effects of smaller, less flashy creatures: termites.

Termites, they knew, ruled the realm of the dirt in the forest, chomping through the drifts of leaves that fell from the trees, digging tunnels and aerating the soil, and “engineering” throughout the ecosystem. But they didn’t know exactly how important the insects were to keeping the forest healthy and functional—so they had set out to tease out their role by removing termites from a particular spot in the forest and seeing how it responded.

As luck would have it, they started their experiment when the forest was gripped by an extreme drought, during the 2015-2016 El Niño event. And what they found—summarized in a paper published Thursday in Science—was unexpected: termites were everywhere—nearly twice as many as during a normal rain year. And those termites helped the forest to withstand the drought intact and healthy: in the termite-rich areas, the soil stayed moist, more tree seedlings sprouted, and the system hummed along despite the long, hard dry spell.

“They’re like ecological insurance,” said Griffiths, an entomologist at the University of York in the U.K. The termites, she explains, ended up protecting the forest from the stresses of climate change.

Termites to the rescue

Termites get a bad rap. They make headlines for chomping through billions of dollars of property each year in the U.S.—and sometimes for literally eating money. And they are responsible for something like two percent of global carbon emissions, simply by dint of their huge populations and penchant for chewing through carbon-rich materials. A whole industry is geared toward killing them.

But they play a key role in many natural ecosystems. Scientists have known for years that in tropical forests, termites chew up fallen leaves and dead wood, keeping the fallen material under control and shepherding nutrients from the dead material back into the system to be used by other plants, insects, and animals.

See how termites inspired a building that can cool itself How do you cool a building without air conditioning? Using an approach called biomimicry, see how architect Mick Pearce harnessed the ingenuity of termites to design a natural cooling system for the largest commercial building in Zimbabwe.

It has been very difficult to disentangle termites’ exact role in many of the ecosystems they inhabit—was it them that did the bulk of the forest floor tidying, or was it the soil microbes, or the ants, or all of them together? But the team figured out a way to get rid of termites and only termites from some little areas of the forest, by dropping little piles of poisoned cellulose—“like toilet rolls, really,” says Griffiths—that the termites and nothing else could digest. Left behind was an ecosystem nearly devoid of termites that they could compare with the unaffected ones, allowing them to tease out the exact role the insects played.

During the non-drought years, they saw, there wasn’t much difference between the normal plots and the ones where they’d removed the termites. But during the drought, the effects were marked. Where there were more termites munching through the drifts of leaf litter, the soil stayed moist and seedlings sprouted, helping the forest coast through the worst drought in 20 years.

“Termites can effectively buffer against climate change,” says Rob Pringle, an ecologist at Princeton University who was not involved in the study. “The more we can do to try to maintain the integrity of natural community assemblages, the more resistant they'll be to the challenges of the future, like climate change.”

The dry future

Scientists predict that as climate change progresses, droughts in the region could get more severe, causing ever more stress to the last bits of pristine Bornean rainforest, says Jane Hill, an entomologist at the University of York who has worked in the Maliau forest for years. But to her, the message is clear: the termites are key to maintaining the integrity of the forest in the face of a changing climate.

But most of the tropical forests left in the world—in Borneo and beyond—aren’t in such perfect, pristine shape, and in many of them, the termite populations have plummeted. “Lots of forests have been fragmented or degraded,” says Hill. “So how resilient are those?”

And in a climate-forced future, even the boost the termites can give the forest might not be enough. “Clearly termites have the potential to be really beneficial,” says Carina Tarnita, an ecologist at Princeton University who was not part of the study. “But what happens to them under climate change? What is their breaking point?”