Phorid flies are tiny—most of them could sit on your pinky nail with some room to spare—but they come from a big family. There are more than 4,000 phorid species, and their lifestyles are incredibly diverse. Some are herbivores, some are predators, some are scavengers, and some are parasites. Many of them are a little gross. 

Take the so-called “coffin flies,” which breed in and feed on decaying plant matter and carrion, including bodies in caskets. Then there are the “ant-decapitating flies.” These species inject their eggs into dead or dying ants. When the larvae hatch, they wriggle their way towards the host’s head and eat its brains and whatever else they can get their mouths on. Eventually, they eat so much that there’s nothing to hold the head on, and they decapitate the ant from the inside.

At least, that’s how it works most of the time. Now, scientists have discovered some ant-decapitators that behave much differently and use a beheading technique that’s never been documented before. 

Entomologists Brian Brown, Giar-Ann Kung, and Wendy Porras have spent decades studying phorids and collected thousands of specimens in eight different countries. On a recent research trip, a fly did something that surprised even them. They were in Brazil watching over ants laid out as bait and waiting for a specific type of fly to show up when Kung saw a different fly land on one of their ants, lop its head off, and fly away with the trophy. The researchers were stunned. In every other ant-decapitating phorid species, it’s the larvae that do the beheading by eating away the inside of the ant’s head, but here was an adult fly doing the dirty work in a much different way and running off with head when it was done.

After doing some more scouting in Brazil and Costa Rica, the researchers found three species that exhibit this “headhunting” behavior. It works like this: A male and female fly arrive at an injured ant together, usually while engaged in some mid-air mating. After they land, the male takes off and the female sticks around to inspect the ant. She circles around it, tapping on the ground and occasionally approaching to poke the ant or tug on an antenna or leg, trying to determine how incapacitated it is. If the ant doesn’t fight back, the fly hops on top of it and begins to jab it just behind the head with her mouthparts. The fly’s proboscis, which is almost as long as her body, ends in a spike flanked by two serrated blades. She stabs these into the ant over and over again from different angles and rotates her head to twist the blades, severing the ant’s nerves, digestive tract, and the membrane that connects the head to the thorax. 

After as little as eight minutes of sawing like this, the head is loose enough that the fly can pull it off with a good tug and drag it away to do what she pleases with it. What that is is still unclear. An ant corpse is usually a nursery for phorids, but the researchers only saw a few flies lay their eggs in the ants and some that they dissected weren’t even carrying eggs. If the head or the headless body isn’t meant to be an egg-laying site, then it’s most likely a meal. Some of the flies Brown, Kung, and Porras studied fed on the insides of the heads they collected, and the researchers think that ant heads may provide the nutrition the flies need to develop their eggs. 

While the flies’ eating habits might be grisly, they’re still picky eaters. The researchers found that the headhunting phorids only targeted trap-jaw ants and ignored other injured insects that were left out for them. Specializing in beheading one particular species could be how they eke out a living in an ecosystem teeming with flies and other insects that feed on and parasitize ants.