If there were a horror movie set in the animal kingdom, a turquoise-green insect named the “crypt-keeper wasp” would likely play a starring role. A new study has found that this crafty, parasitic wasp can manipulate other parasitic wasps to finish an assigned task and then become its meal.

The amber-colored victims are known as “crypt gall wasps” (Bassettia pallida). They nest in tiny cavities called “crypts” on their host tree, which provides free nutrition throughout its development. Typically, when the adult wasps are ready to leave, they chew a hole through the tree’s woody tissue and make their way out. But for some gall wasps, things don’t go according to plan. [The 10 Most Diabolical and Disgusting Parasites]

Instead of exiting the hole they make, the wasps would plug the holes with their head and die, researchers found. This is because the wasps are being manipulated by another crypt-residing wasp that capitalizes on the gall wasps’ ability to chew a hole for its own exit. After the “crypt-keeper wasp” gets its host to create a hole, it eats its own way through the host. This grisly behavior earned the wasp its scientific name, Euderus set (Set being the ancient Egyptian god of evil).

The crypt gall wasp, Bassettia pallida. Andrew Forbes

To learn how the wasp benefits from manipulating its host into plugging the hole, scientists covered some head-plugged holes with bark. When the crypt-keeper wasp had to get through the extra bark, it was three times more likely to get trapped in the crypt and die than a wasp that had to get through only the head and no bark, said lead study author Kelly Weinersmith, a parasitologist at Rice University in Houston.

Get Breaking News Delivered to Your Inbox

“So, it looks like the specific purpose of the manipulation is to help the crypt-keeper wasps emerge, because they are weaker excavators than their hosts,” Weinersmith told Live Science. “They need the hosts to do that work for them, so they can get out.”

Details of how a crypt-keeper female zeroes in on a developing gall wasp’s crypt are yet to be uncovered. Weinersmith thinks a female either lays an egg directly into the body of the host or into the crypt next to the host using its egg-laying organ.

When the scientists cut open stems to reveal the inside of the head-plugged crypts, they found larvae and pupae of the keeper wasp lying partly inside the body of their hosts, with the host’s entrails missing. “We don’t know if they eat their way out or if they get to that development stage and then eat their way in,” said Weinersmith. Either way, the host ends up dead.

Because all but four of the 168 head-plugged crypts studied had a keeper wasp, it’s clear that the gall wasps did not die from accidentally getting stuck in the holes as they tried to emerge. Moreover, the escape holes that the parasitized hosts made were smaller than those of non-parasitized gall wasps, indicating manipulation by the crypt-keeper wasp, the researchers said.

In this photo, the bark has been dissected away to reveal two Bassettia pallida adults residing within their crypts. Sean Liu

“In nature, we do see gall wasps getting stuck sometimes, but when they do, they usually get stuck between their head and abdomen,” Weinersmith said.”It is very rare for them to get stuck the way we see them getting stuck [when parasitized] — with one eye looking out from the hole.”

The detailed findings of the study were published online Jan. 24 in the journal Proceedings of the Royal Society B.

Original article on Live Science.