For the past few years, the world has been on the edge of one of the biggest medical triumphs of modern history: Wiping out a horrific parasite from the face of the Earth.

In the early '80s, there were 3.2 million cases of Guinea worm — a two-feet long worm that emerges slowly — and excruciatingly — from a blister on the skin.

A massive campaign, led by President Jimmy Carter, has eradicated the worm from all but four countries. And this year, there have been only seven cases, the Carter Center reports.

"I'd like for the last Guinea worm to die before I do," President Carter told reporters last year.

But a surprising wrinkle has cropped up: The worm has found a new way to hide and thrive.

Back in 2013, something strange started happening in Chad: Dogs were showing up with Guinea worm emerging from their legs. Many dogs. With many, many Guinea worms.

"A 2-year-old female dog had a record 62 Guinea worms emerge from it," says David Molyneux, at the Liverpool School of Medicine, who has worked on stopping Guinea worm for 40 years.

"That's a huge infection in an animal. I mean I've never heard of that before. That's extraordinary," he says.

So many worms in one dog means one thing: "There's an awful lot of Guinea worms out there," Molyneux says.

This year there have been more than 600 hundred dogs infected with Guinea, scattered across a large part of Chad, which is nearly twice the size of Texas.

"This is a massive challenge," Molyneux says. "It's going to be a longer haul [to eradication] than we anticipated."

Other scientists agree.

For more than a hundred years, scientists thought they had Guinea worm figured out. They thought the critter needed people to survive and reproduce. So if you got rid of cases in people, the worm would go extinct.

But now it looks like Guinea worm might not need people, says Mark Eberhard, a scientist with the Centers for Disease Control and Prevention, who just got back from Chad to assess the dog situation. "It looks like dogs can drive infections, too."

And so to eradicate Guinea worm, the world has to wipe out the worm not only in people but also in dogs.

And that, right now, is a big challenge, Eberhard says.

To keep dogs from spreading Guinea worm, they have to be tied up for two weeks, while the worm or worms come out of their legs. Otherwise the dogs could contaminate nearby water and spread the parasite to an entire village.

But dogs in Chad aren't like dogs here in the U.S. They're not pets. They don't come inside or sleep on the bed.

Families keep them to protect their crops from baboons and other critters. "They are, in most instances, no more or no less part of the household as are the chickens, the goats and the cattle," Eberhard says. "Many of them roam free, night and day."

So the Carter Center is paying people $20 to tie up infected dogs. The agency is also giving them collars and chains. "People seem to be using them," Eberhard says.

But there's another big problem: No one knows how the dogs are getting infected.

At first they thought dogs were eating infected fish guts. Now they think it might be frogs.

An international team of scientists have started using GPS collars to track the dogs and radio isotope labeling to figure out what food is left on their whiskers.

Right now, Eberhard says, euthanizing the dogs is "off the table."

"That's quite a drastic intervention," he says. "More than 10,000 dogs would need to be culled. That would be the largest culling project for dogs ever."

Despite these huge challenges, the Carter Center is undeterred about eradication.

"This problem in dogs is new and unprecedented," says the Carter Center's Dr. Donald Hopkins, who has led the effort to eradicate Guinea worm. "I'm confident we're going to do it. We've have already seen 17 of 21 countries get rid of Guinea worm, and it's stayed away there."

Copyright 2016 NPR. To see more, visit http://www.npr.org/.