Pathogens are real jerks. As if infecting and killing plants and animals isn’t bad enough, they can also turn their hosts into zombies that spread the pathogens to their next victim.

Now scientists report that bacteria make some victims summon other victims as their dying act. The bacteria hijack the chemical signaling pathway of insects, making them release a burst of hormones that serve as a beacon to attract friends and potential mates right before the bacteria kill off the host.

Like malware marauding as an enticing link, the bacteria attract and then infect.

Fruit flies are generally pretty good at avoiding hazards. They can detect when food is infected with a dangerous mold or when a parasitic wasp is nearby, said Markus Knaden, a researcher at the Max Planck Institute for Chemical Ecology in Jena, Germany, who was involved in the study. In both cases, the flies won’t lay their eggs near the infectious agent. That’s why Knaden and colleagues at Cornell University were so surprised when they found that flies were actually attracted to other insects with a certain bacterial infection.

“If you’re sitting in a theater and someone next to you is coughing, you move to another chair,” said Bill Hansson, one of the Max Planck authors of the study, published Wednesday in the journal Nature Communications. They expected flies to behave the same way, but instead, healthy flies found their sick friends to be extremely attractive.

This particular bacteria, Pseudomonas entomophila, is toxic to several types of insects, but not humans or plants, so it could be useful in controlling agricultural pests. While the flies were not attracted to the bacteria itself, they were infatuated with other infected flies — and their bacteria-filled feces.

It’s common for fruit flies to use their strawlike proboscises to probe the feces of their fly friends. They are attracted to their neighbors' droppings, which generally signal that a food source is nearby, and they often visit a potential mate’s droppings before copulating, Knaden said. This attraction is driven by pheromones, specialized hormones that signal: “Hey friends, over here” or “I’m lonely and looking for a mate.”

Knaden and his colleagues showed that flies infected with the bacteria churned out 20 to 30 times more pheromones than healthy flies, with the peak in hormone output occurring shortly before death. Healthy flies were more likely to visit feces from infected flies, and male flies preferentially tried to mate with infected females.

The researchers engineered the bacteria to produce fluorescent proteins, so they could track their infection throughout the fly life cycle. Live, glowing bacteria were present in the droppings of infected flies. The researchers suggest that the bacteria cause the flies to produce more pheromones to attract other flies, which are easily infected when they go sniffing around the sick fly’s feces. How the bacteria accomplish this feat is still a mystery; that’s the question the team hopes to tackle next, Hansson said.

This is not the first example of a pathogen or parasite manipulating its host. There is a fungus that infects ant brains and directs the insects to die in a place suitable for fungal growth, a parasite that makes rats attracted to cats, and bacteria that cause plants to release compounds that lure insects.

“We might have similar things going on in humans,” said Hansson. For example, there is evidence that mosquitoes prefer to feed on people infected with malaria. There may be some chemical signal the malaria parasite causes people to emit that draws mosquitoes, which then spread the disease.

Despite the many examples, the mechanisms by which pathogens control their hosts are poorly understood in most cases. “This is the first time a pathogen has been clearly shown to have such a strong effect on pheromone production,” Hansson said.

Insect pheromones are an active area of research in part because they can be used as a specific, nontoxic form of pest control. Once the pheromone of an insect pest is identified, scientists can work to synthesize the compound and use it in traps that will specifically attract problem bugs while not harming beneficial insects such as bees or lady beetles.

Anyone who has had a kitchen infested with fruit flies might be on the bacteria’s side in this battle. “There’s a pretty big market for traps in supermarkets,” Hansson said.

Read More: