Oily, orange coffee rust is a fungus that grows on coffee crops in splotches. Left alone, it causes the coffee crops’ leaves to fall off, reducing its caffeinated yield and killing the plant within years. In 2016, ecologists conducting fieldwork in Puerto Rico noticed another bit of bright orange on a coffee leaf: a small loop of vibrant poop.

They followed the trail and found an Asian trampsnail (Bradybaena similaris). To their surprise, the small, plant-eating mollusk seemed to be munching on the coffee rust, according to a recent study published in the journal Ecology.

“Cool things pop out and you follow up with them,” University of Michigan ecologist Zachary Hajian-Forooshani tells Luke Fater at Atlas Obscura. “I just followed a trail of excrement.”

Snails eat with thousands of microscopic teeth that scrape up food from whatever they’re gliding across on a trail of mucus. Asian trampsnails are a common species, native to Southeast Asia, but they are now invasive in many tropical and near-tropical regions around the world.

On coffee leaves, Hajian-Forooshani and his team found that the snails were eating the infectious fungus, but not the plants. It was a surprising find, since scientists had only observed herbivorous—not fungivorous—Asian trampsnails until now.

The team conducted experiments in pie tins in a makeshift laboratory, Hajian-Forooshani tells Atlas Obscura. In 24 hours, one Asian trampsnail could clear almost a third of the rust from a leaf. Another, native species of snail was observed for comparison and didn’t eat the coffee rust.

This finding could be good news for coffee farmers in Puerto Rico. The coffee rust fungus is notoriously difficult to get rid of. It was first found in Sri Lanka, an island south of India, in the 1800s. But with only the wind to carry the fungal spores, coffee rust spanned the Arabian sea to infect coffee plants in Africa, and then again traveled on the breeze to cross the Atlantic.

Coffee rust reached South America and the Caribbean in the 1950s, and random outbreaks have seriously hurt coffee production in the Americas since the 1980s, Forest Ray reports for National Geographic. Attempts to use chemical treatments and hardy coffee plants have only worked for a little while at a time because the fungus evolves quickly. A very hungry snail might be just the thing farmers need.

“It is challenging to develop resistance to being eaten,” Hajian-Forooshani tells National Geographic.

But Hajian-Forooshani and other experts are exercising caution, and definitely not suggesting that Asian trampsnails should be sprayed across coffee fields like another pesticide. The snail is a crop pest on citrus and melon plants, which are grown in similar environments to coffee. And humans’ past attempts at introducing species to do our bidding haven’t gone well: venomous cane toads, when 3,000 toads were introduced to Australia in 1935 to manage pesky cane beetle populations, they ignored their task and now there are millions of them.

“I’d be very worried about moving snails around the world,” Oliver Windram, an expert in fungal pathology who wasn’t involved in the research, tells Atlas Obscura. He suggests that increasing the diversity of plants around the coffee crops could stop the fungus from spreading instead. “If you plant non-host trees around an infected area, when the wind blows, the spores are more likely to just land on a non-host plant, germinate, and die.”

The researchers also found in a second trip to the coffee plantation that the snails aren’t totally committed to eating coffee rust alone. When the rust was infected with Lecanicillium lecanii, a parasite of the orange fungus, snails ate that, too. Their current research is trying to untangle the relationship between the snails, coffee rust, and Lecanicillium lecanii. This understanding will be vital to any attempts at fungus-control, because if it turns out that the snails eat more parasite than rust, they could remove a natural barrier to the rust’s spread, unleashing an outbreak.

“Classic approaches to pest control have often failed to understand this complexity, causing major natural disasters,” University of California, Santa Cruz agroecologist Estelí Jiménez-Soto, who focuses on biocontrol measures and coffee, tells National Geographic.

The finding shows how adaptable snails are to different environments, though. “We didn’t have it anywhere in our minds that such a small snail could be eating rust like this,” Hajian-Forooshani says to Atlas Obscura.