Somewhere in the Brazilian rainforest, a lone carpenter ant marches out of its nest towards its doom.

The ant is infected with a fungus called Ophiocordyceps unilateralis, which has both infiltrated and commandeered its body. While it devours the ant alive, it also sends its zombified host scurrying up a plant stem. The ant walks along the underside of a leaf and vigorously locks its jaws around a vein. This is a death-grip; those jaws will never open again. In a week or so, a long stalk erupts from the ant’s head growing outwards and downwards into a bulbous capsule, which releases a rain of spores. If other ants walk underneath, they become infected.

The fungus controls its zombie host with incredible precision. The ant always climbs to around 25 centimetres above the soil—a zone with just the right temperature and humidity for the fungus to grow.

But why does the ant leave its nest in the first place?

Outside, the fungus needs to drive its host to a spot that offers the best chance of raining spores down upon passing workers. But inside the nest, there are thousands of such workers nearby. With this dense smorgasbord of new hosts to infect, why does the fungus send its current host into the great outdoors?

Perhaps these forays are the ants’ doing. Colony-living insects like ants have a kind of social immune system—they behave in ways that prevent infections from spreading through their nests. They clean each other and remove the corpses of their nestmates. Sick ants, which have been infected by killer fungi, are often shunned by their fellow workers, and sometimes leave the nest to die alone. Biologists often view these as acts of self-sacrifice, as if the ant was a six-legged Captain Oates.

But Raquel Loreto and David Hughes from Pennsylvania State University see things differently. The duo first realised what was going on when they collected carpenter ant nests, and seeded them with ants that had been freshly killed by Ophiocordyceps. The ants detected and removed around half of these remaining cadavers—a clear example of their vaunted “social immunity” at work. But they needn’t have bothered. It turns out that the fungus simply cannot grow inside the nests of its hosts. Even if the cadavers were placed in nests that had no ants, the fungus still wouldn’t sprout.

“The best place for the sick individuals is at home!” says Hughes, who had been studying the zombifying fungi for many years. “In a naive framework, leaving the nest appears to be altruistic but it’s actually part of the fungus’ manipulation.”

So, what happens outside the nest? To find out, Loreto trekked into the same stretch of Brazilian rainforest for 20 months to study 17 specific carpenter ant nests. She ventured into the jungle at night with infrared torches to map the foraging trails that the workers walk along.

She also marked out a 200-cubic-metre zone around four of the nests nest —an area that she calls the “doorstep” of the colony. It’s the zone that all workers must pass through on their way in and out of the nest. Once a month, Loreto walked through these doorsteps and checked the underside of every single leaf within them for the zombified corpses of infected ants.

“This is important because it’s one of the few field studies of ant-parasite interactions,” says Sylvia Cremer from the Institute of Science and Technology Austria. Most people who study social immunity have exposed ants to parasites within the artificial confines of a laboratory. “It’s always good to bring some realism to these discussions,” says Hughes.

At the end of her Herculean effort, Loreto had found zombified corpses around every one of the 17 nests she studied. And she kept on finding new corpses every month around the four nests she studied in detail. The results were clear: despite the ant’s vaunted social immunity, the fungus infects close to 100 percent of the nests in the area, and does so throughout the year. It’s a permanent and omnipresent threat.

The team thinks that the fungus is so successful precisely because it sends its hosts outside the nest. Inside, the ants’ social immune system can protect them. Outside, it doesn’t work. “Over 20 months, Raquel never saw the colony disinfecting its borders,” says Hughes.

The ants also rely on the same trails, so the fungus is virtually guaranteed to find new hosts if it positions its current one in the right spot. Hughes compares it to a sniper’s alley. “The foragers come out at night and pass under the cadavers of their siblings that are now shooting spores at them,” he says.

But why wouldn’t the carpenter ants evolve a countermeasure? Over time, surely you’d expect them to start removing infected corpses from the leaves around their nests, as other species of ants do elsewhere in the world. Hughes suggests that they might not need to. Young carpenter ants stay exclusively within their nests. They only venture out to forage when they get older, so the fungus can only ever infect ants that are near the end of their lives anyway.

This strategy seems to suit both parties. The ants ensure that only their weakest members face death by zombifying fungus, and the fungus get a continually renewed supply of susceptible hosts to infect. It’s as close to a win-win as you get in evolution.

Reference: Loreto, Elliot, Freitas, Pereira & Hughes. 2014. 3D mapping of disease in ant societies reveals a strategy of a specialized parasite. BiorXiv. http://dx.doi.org/10.1101/003574