A droning sound that fills your backyard at volumes exceeding 100 decibels is a sign that the cicadas have emerged for the summer. The noisy bugs have one of the most fascinating lifecycles of any insect species—spending up to 17 years of their lives underground as nymphs before finally crawling to the surface, molting their exoskeleton on the first elevated surface they can find, and mating as mature adults for a few weeks before expiring. As The New York Times reports, a recent phenomenon observed by scientists is making this process even stranger. Many cicadas have fallen victim to a psychotropic fungus that invades their bodies and compels them to keep mating even after their genitals have been replaced with fungal spores.

A study recently published in the journal Fungal Ecology explores how exactly the fungus is able to prey upon its hosts. Massospora is a genus of fungi that lives in the soil where young cicadas spend the first part of their lives. A cicada that digs through dirt containing Massospora emerges contaminated with fungal spores. The spores proliferate as the insect matures, eventually eating through its abdomen and destroying its reproductive system.

But the goal of the fungus isn't to kill its host immediately. Even when two thirds of a cicada's body is made up of Massospora, it continues to fly around, committed to its purpose at the end of its life—reproducing—seemingly more than ever. And when it tries to mate, the white clump of spores where its genitals should be can potentially infect a new victim.

The researchers could see how Massospora spread from cicada to cicada, but why the cicadas were driven to keep mating in such poor condition was more of a mystery. Their paper points to psychotropic substances found in the fungus—including the same compound that makes magic mushrooms a Schedule 1 drug.

The spore plugs of infected cicadas contain psilocybin, the hallucinogen in magic mushrooms; and cathinone, an amphetamine found in the East African khat plant. When the researchers sequenced the genomes of Massospora, they found that the fungus didn't contain either the genes used by magic mushrooms or khat to produce their mind-altering substance. This could mean that the cathinone and psilocybin found in the spore plugs are the products of a chemical reaction between the fungus and something in its cicada host, possibly the bacteria in the insect's gut. The two compounds also appeared independently in different types of cicadas: annual cicadas were effected by psilocybin, and periodical cicadas, which include 17-year and 13-year cicadas, contained cathinone.

In people, psilocybin has been shown to combat symptoms of depression and anxiety, while cathinone can improve focus in people with ADHD. It's possible that some version of these effects are amping up the infected cicada's sex drive. In their drugged-out stupor, the host insects seem hyper-focused on mating, even though they're unable to reproduce. It's easy to see how this benefits Massospora: The more cicadas its host tries to copulate with, the more insects are exposed to its spores. Why cicadas would have evolved to synthesize the narcotics in the first place is less clear.

[h/t The New York Times]