Leafcutter ants, which can live in colonies of a million or more, maintain a famously complex relationship with several species of fungi—some of which provide the insects with nutrients and some of which, like Escovopsis, are dangerously parasitic. Scientists have wondered how the ants can live in such large numbers without being ravaged by disease. New research published online today in the Proceedings of the Royal Society B hints that some members of the Atta genus may combat infection with a foul-smelling acid. Whenever they spot Escovopsis, they secrete phenylacetic acid from a special gland in their thoraxes, a strategy that kills the fungus and sets the ants apart from close relatives that cultivate bacteria and other microbes to fight off the fungi. The team also found that as colonies grew larger, Atta ants acquired more specialized roles and body shapes. An entire subset of small worker ants, for example, develops enlarged glands and seem to specialize in finding and treating fungus outbreaks. So far, there have been no observed instances of an Escovopsis outbreak destroying a colony. The fungi are fighting back, though: The authors state that populations of the fungus living alongside the ants display an increased resistance to phenylacetic acid. How the ants have managed to use the same chemical treatment for millions of years without being overrun remains unclear, but the authors speculate that part of the ants’ success may result from an extremely judicious use of their acid defense; they never use it unless there’s an infection, and they only treat infected areas using a precise grooming method.