The living dead may buzz among us. Attacked by a fungus that takes over their bodies, flies start acting erratically in the moments before they die, playing an unwitting role in spreading the fungus even further. Scientists call them “zombie flies,” and they are found across North America and Europe.

On Tuesday, a team of biologists and engineers seeking biological inspiration for fly traps studied the fungus and reported new insights into how the microorganism launches its attack. Their results were published Wednesday in the Journal of the Royal Society Interface.

Sometimes pesky house flies encounter the fungus, called Entomophthora muscae, as they go about their day, sniffing out food and seeking mates. The fungal cells release cuticle-cutting enzymes and slip inside the insect’s body. There, the fungus grows into long threadlike structures, digesting the fly’s guts and penetrating its brain until the poor insect finally dies.

But E. muscae determines when and where the fly dies so that it is in the best position to release fungal spores onto other unsuspecting flies. By exerting a bit of mind control, the fungus forces the fly to seek an elevated perch and lift its wings in an unnatural position. This allows the fungus to grow from the insect’s back and abdomen, taking the form of stripes of white fuzz, even after the fly dies.