On Costa Rica, inside a wheel of sticky silk, an orb weaver spider is doomed to die. She is a formidable predator, but this Leucauge argyra has fallen victim to something even worse. A white grub is stuck to her abdomen, and it’s growing bigger while the spider shrinks.

One day, the spider stops building her usual orb web. Instead, she keeps repeating the first few steps, creating a “cocoon web”: a bag, strong enough to withstand Costa Rica’s heavy tropical rains.

The large grub now turns ruthless. It sucks out the spider’s remaining life juices and throws out the skinny remains. Then it spins a cocoon for itself, supported by the cocoon web. A few weeks later a wasp emerges, with a slender waist and metallic sheen. The grub has grown up.

The ghoulish wasp is called Hymenoepimecis argyraphaga. Its larva injected a chemical into the spider to control its actions, making it a slave.

The wasp’s way of life may seem like a pretty raw deal for the spider. But in fact this sort of behaviour is astonishingly common. The wasps that lay their eggs on the bodies of other animals may well be the most diverse group of animals on Earth. Nature, it seems, loves animals that play dirty.

Read more on BBC Earth website.