The fungus Entomophthora muscae has a survival strategy that's both fascinating and potentially going to put you off your next meal: it infects and 'zombifies' female houseflies before sending out irresistible chemical signals encouraging male houseflies into necrophilia.

By luring these male flies into mating with zombified females, the fungus can transfer to the male fly and, in theory, have a better chance of further dispersal. The unlucky male fly is then taken over by E. muscae in the same way.

Crucial to the process is the release of sesquiterpenes, or chemical messages, which are synthesized in the female cadaver and sent out as a seductive signal. Based on the experiments carried out by the researchers, the longer the corpse has been dead, the more attractive it appears to be to the males.

"The chemical signals act as pheromones that bewitch male flies and cause an incredible urge for them to mate with lifeless female carcasses," says evolutionary biologist Henrik H. De Fine Licht, from the University of Copenhagen in Denmark.

Once E. muscae has infected a female fly with its spores, it starts to multiply. After around six days, it can control the behavior of the insect, sending it up to the highest possible point (on a wall or a plant) before it dies. Fungus spores are then sent out from the dead fly, hoping to land on another.

But as this new study shows, by enticing a male over, E. muscae can ensure it passes into at least one more host, which will carry its spores far and wide again.

The team used a variety of chemical analysis and genetic sequencing techniques to figure out exactly what the fungus was doing, as well as exposing male flies to female partners at different stages of fungal infection, or that had died from other causes.

"Our observations suggest that this is a very deliberate strategy for the fungus," says H. De Fine Licht. "It is a true master of manipulation – and this is incredibly fascinating."

Tests showed that female fly corpses that had been dead for 3-8 hours attracted 15 percent of male flies, whereas with corpses that had been dead for 25-30 hours, that figure shot up to 73 percent. The more time that passed, the more chemical signals were released.

This isn't the only time that scientists have observed sesquiterpenes being used to attract the attention of insects. As chemical signals go, it appears to be one of the most effective at manipulating these tiny creatures.

There are plenty of opportunities for further research here, not least into effective fly repellents – flies can infect humans with various diseases, and sesquiterpenes could be used to lure flies away from certain areas, such as where food is being prepared.

"This is where the Entomophthora muscae fungus may prove useful," says H. De Fine Licht. "It might be possible for us to use these same fungal fragrances as a biological pest control that attracts healthy males to a fly trap instead of a corpse."

The research has been published in the ISME Journal.