This story appears in the September 2016 issue of National Geographic magazine.

An emerald ash borer hovers, checking out the female forms below him. He’s drawn by how light plays across their bodies. He picks one, approaches, initiates physical contact—and is zapped by 4,000 volts.

Trying to mate with an electrified decoy is a grisly way to go. But entomologist Michael Domingue has no qualms about killing the emerald ash borer, or EAB for short. Since 2002 EABs have killed hundreds of millions of North America’s native ash trees.

To catch them, Domingue and his Pennsylvania State University colleagues created a literal femme fatale: a faux female, battery-powered so it would lethally shock any male that mounted it. The scientists made a rough version of the decoy on a 3-D printer; EAB males looked but didn’t land. The researchers also made a more realistic model, with a similar emerald hue and light-scattering surface texture as a real EAB shell. In tests using both real dead females and high-fidelity decoy females, virtually the same number of EABs alighted on each.