Like something out of a horror movie, the zombie-ant fungus attacks and invades the brains of carpenter ants. Possessed ants march to their death, and the fungus lives inside the exoskeleton.

Now, a new study reports that the zombie-ant fungus itself faces attack by another fungus.

This secondary attacker, a white fungus, is “looking for its own lunch, and it thinks this dead ant is a nice thing to eat, along with the fungus that’s eating the ant,” said David Hughes, a disease biologist at Penn State and one of the authors.

This attack prevents the spores of the zombie-ant fungus from spreading and infecting other ants in the colony, Dr. Hughes said.

“Looking at the colony, it’s a good thing for the ants,” he said. “The enemy of my enemy is my friend.”