Files from 2013 show a live hairworm in Bruno de Medeiros's hand and in the environment, in the Muir Woods National Monument in California.

Editor’s note: Sign up for CNN’s Wonder Theory science newsletter. Explore the universe with news on fascinating discoveries, scientific advancements and more.

CNN  — 

Threadlike worms living in the guts of certain insects make their hosts jump into water and drown.

What scientists knew about these parasites resembling strands of spaghetti was already pretty bizarre.

The larvae infest arthropods, such as crickets and beetles, and grow for several months inside their terrestrial hosts, but they must return to water to mate and lay eggs. To do that, the worms manipulate a host’s behavior, compelling it to seek water and plunge in. The parasites can then wriggle out of the host’s rear end and swim away.

But the worms just got a lot weirder.

Genetic analysis has revealed that horsehair worms — scientifically classified as the phylum Nematomorpha — took an evolutionary detour many millions of years ago that cost them about 30% of genes that are found in all other animals.

Scientists discovered the loss when they sequenced the genomes of two nematomorph species: the freshwater hairworm Acutogordius australiensis and the marine species Nectonema munidae.

Which genes were missing?

While the worms’ behavior has been well-studied, little is known about their genetics. The researchers who sequenced the genomes of A. australiensis and N. munidae hoped to change that, said Tauana Cunha, lead author of the study that published Tuesday in the journal Current Biology. Cunha is now a postdoctoral research scientist at Chicago’s Field Museum of Natural History but began the research as a doctoral candidate in the department of organismic and evolutionary biology at Harvard University.

However, when the scientists compared their horsehair worm genomes with genomic information from other animals, something was missing, Cunha told CNN.

“There’s a given set of genes that are expected to be found across animal groups,” she said. “It’s used as a metric for the quality of your genome.” The same group of genes — about 200 in all — was absent from both horsehair worm species, suggesting that this was a genomic quirk in the group rather than a data error.

Further analysis revealed that the genes controlled cilia development, the study authors reported.

two live tangled individuals of Gordionus violaceus, a freshwater hairworm

These genes, which also exist in single-celled organisms called protists and in some plants and fungi, regulate the development of short, hairlike structures at the cellular level, called cilia. Cilia act as sensors, help cells move, and filter microbes and debris. A sperm cell’s tail is a specialized single cilium; cilia also help microscopic organisms swim and capture food. These structures coat the surfaces of our lungs and respiratory tract and grow in cells in our retinas.

Mysteries remain about the worms’ movements

As useful as cilia are, horsehair worms seem to be doing just fine without them, the scientists reported. Prior studies of nematomorphs have noted that they lack cilia, but this had not been explored at the genetic level. The new study presents a fresh perspective on the anomaly, “combining genome-scale molecular data and detailed morphological observation,” said biologist Keiichi Kakui, a lecturer in the department of biological sciences at Hokkaido University in Japan.

Kakui, who was not involved in the new research, was the lead author for a study that identified the first known examples of marine horsehair worm juveniles in deep-sea crustaceans called isopods. But it is unknown how those parasites navigate their environment, particularly when they lack basic sensory structures that most animals possess, Kakui told CNN in an email.

“It is hard for me to imagine how this species finds and enters their host in (the) vast deep-sea,” Kakui said.

To date, scientists have identified several hundred species of freshwater horsehair worms and five species of marine horsehair worms. Marine horsehair worms spend their entire lives in water, but freshwater species are only aquatic as adults. Behavior manipulation of host animals is known only in freshwater species.

Because marine and freshwater horsehair worm lineages diverged millions of years ago, the genetic loss likely happened in an ancestor and both lineages inherited genomes lacking the genes for cilia, Cunha explained. “By sequencing more species of hairworms, we would find even more evidence for that.”

staged photos of t he (dead) squat lobster host Munida sp., from Norway, with a hairworm. In the second photo the carapace of the lobster was opened to show the space where the worm was found.The photo was taken now as a representation of the real scenario of how the worm was collected years ago, which was used for the genome sequencing.

According to Kakui, the work is “a great advance,” with the genomic data offering valuable insights into phylogenetic relationships and the evolution of parasitism in nematomorphs and their close relatives.

Other ‘mind-controlling’ parasites

Parasites that alter host behavior occur across many different groups. Ophiocordyceps — the fungal inspiration for the “cordyceps” infection in the HBO series “The Last of Us” — hijacks the brain of an ant, compelling it to climb to elevated perches where it dies, while the fungus erupts from its corpse. The protozoa Toxoplasma gondii suppresses rodents’ fear of predators, and makes infected wolves more reckless when it comes to pack dynamics. Parasitoid wasps that lay their eggs inside caterpillars also deliver chemicals that turn the hosts into bodyguards for the wasps’ young.

The video above, taken by entomologist Bruno de Medeiros, assistant curator of insects at the Field Museum of Natural History, shows freshwater horsehair worms in California’s Muir Woods National Monument.

Scientists are still piecing together the molecular mechanisms that trigger these behavioral changes. More genomic data will make it possible for researchers to compare genes and identify their roles in behavior control across multiple parasitic species, Cunha said.

“Do they share some similarities in those mechanisms — in those genes that they have or don’t have?” she said. “These are some of the questions that we will be able to target better, now that we are building more genomic resources for different animals that were not represented before.”