It’s a classic David and Goliath story, except there are 90,000 Davids and they all have stings. On the African plains, the whistling-thorn acacia tree protects itself against the mightiest of savannah animals – elephants – by recruiting some of the tiniest – ants.

Elephants are strong enough to bulldoze entire trees and you might think that there can be no defence against such brute strength. But an elephant’s large size and tough hide afford little protection from a mass attack by tiny ants. These defenders can bite and sting the thinnest layers of skin, the eyes, and even the inside of the sensitive trunk. Jacob Goheen and Todd Palmer from Kenya’s Mpala Research Centre have found that ants are such a potent deterrent that their presence on a tree is enough to put off an elephant.

African plants have many defences against elephants. Some try to match them for strength by developing thick buttresses. Others rely on physical defences like thorns and poisons. Yet others abandon the fight and concentrate on being able to re-grow quickly. None of these measures is foolproof; despite these efforts, elephants frequently damage trees, severely and sometimes fatally.

The whistling thorn acacia (Acacia drepanolobium) is a striking exception. Even in the heart of elephant country, it’s rarely touched and can grow in dense forests. It’s no coincidence that the whistling thorn has a partnership with ants. It provides them with homes in the form of swollen thorns, and food in the form of nectar. In return, the ants attack any invaders, regardless of their size.

Goheen and Palmer found that six young elephants were happy to feed on branches from either the whistling-thorn acacia or a related species – the blackthorn – if they didn’t have any ants. If ants were about, the elephants avoided both types of branch. These results showed that there’s nothing about the whistling-thorn that’s inherently off-putting to elephants; it’s the ants that make the tree a no-go zone.

In fact, elephants seem to have a general weakness for stinging insects. A few years ago, Lucy King from the University of Oxford showed that recordings of angrily buzzing bees were enough to drive away resting herds. King suggested that villagers could use strategically placed hives to ward off marauding pachyderms in the same way that whistling-thorns rely on ants.

To see if the ants could actually protect trees in the wild, Goheen and Palmer systematically inundated hundreds of acacias with smoke to drive away their resident ants. Once the trees had been denuded, the duo put sticky tape around their bases to prevent the ants from returning. A year later, the ant-less trees were far more likely to bear the signs of elephant-inflicted injuries than trees that still had their bodyguards.

Over a long period of time, these small differences can lead to substantial changes in the African landscape. Goheen and Palmer showed this by focusing on an area of Kenya’s Laikapa plateau, where elephants had become five times more common between 1992 and 2002. During that time, the duo had set up big electrified fences to keep out large plant-eaters, as part of a long-term study into the effect of Africa’s grazers.

They found that whistling-thorn cover stayed the same both inside and outside of the “exclosures”. In contrast, related acacias without the protection of ants became far less common outside the protected areas. It is extraordinary to think that these tiny insects can decide the fates of entire forests, at the hands of the savannah’s largest animal.