If you thought mind-controlling fungi were already scary, just wait — the shrooms are even more strategic than we thought.

The so-called "zombie ant fungus" Ophiocordyceps camponoti-rufipedis (which is actually one of several species of zombie ant fungi) is so-named for its ability to control the behavior of its host — in this case, the carpenter ant Camponotus rufipesThe fungus compels the infected ant to climb up vegetation and bite onto a leaf, providing a secure connection to the plant when the ant dies. Then, a rather nightmarish stalk emerges from the ant corpse, and spores are discharged to the forest floor. When they fall, they're meant to hit other ants and continue the fungi's reproductive cycle.

But why doesn't the fungus send the ant right back home, where it can infect the rest of its colony directly? Researchers believed that the fungus was unable to flourish inside the ant nest, and a new study published Monday in PLOS ONE seems to suggest that's the case. And since it can't survive inside the nest, the fungus does the next best thing: It plants the infected corpse just outside, hanging over paths that the ants commonly take.

"Ants are remarkably adept at cleaning the interior of the nest to prevent diseases," study co-author David Hughes, assistant professor of entomology and biology at Penn State said in a statement. "But we also found that this fungal parasite can't grow to the stage suitable for transmission inside the nest whether ants are present or not. This may be because the physical space and microclimate inside the nest don't allow the fungus to complete its development."

To get around this s0-called social immunity, Ophiocordyceps camponoti-rufipedis leaves the zombie host just far enough from home for the fungus to thrive — but still close enough to infect other ants.

"What the zombie fungi essentially do is create a sniper's alley through which their future hosts must pass," Hughes said. "The parasite doesn't need to evolve mechanisms to overcome the effective social immunity that occurs inside the nest. At the same time, it ensures a constant supply of susceptible hosts."

Because these ant colonies only send their oldest workers to collect food (to protect the more valuable able-bodied workers), the highly effective tactics of the fungi don't decimate the ant population. The carpenter ants only lose their oldest and weakest colony members, so the parasite remains as a sort of chronic condition of the community.