It was all going so well for Matthew Barnett. In his first three marathons in three days, completed as part of the World Marathon Challenge -- the ultimate endurance test consisting of seven marathons, on seven continents, in seven days -- the 42-year-old had finished each at around four hours. Despite having only run four marathons, total, in his entire life prior to the challenge, Barnett felt strong, fast and confident.

Antarctica had been breathtaking: the glaciers, the mountains, the 24 hours of sunlight. Chile was lovely -- the people running out toward the course, handing gifts to the runners, the stray dogs hanging around the parks. Miami had provided another boost, with hundreds of fans cheering along the course. Barnett, a pastor and co-founder of the Los Angeles-based Dream Center, was attempting the third annual World Marathon Challenge as a fundraiser for the center. He'd already raised close to $1 million; he felt that by completing the challenge alongside 32 other international competitors, he could inspire and motivate many of the Dream Center residents to complete goals of their own.

Then, in Madrid, about two-thirds of the way into the European marathon, Barnett heard a pop and felt a strange stretching in his knee. And pain -- a lot of pain. "I couldn't believe it, I thought I was done," says Barnett. He stopped running, assessed the physical damage and decided to try and finish. "I started walking my leg, dragging it along like Frankenstein, and the tendon felt like it was pulling with each step." He finished in four hours, 50 minutes.

In Marrakesh, Morocco, the weather was hot, and Barnett hoped that with some stretching, he'd feel fine. But the pain stayed with him for every step. "It was really, really bad," Barnett says. He crossed the finish line in six hours and five minutes.

Next stop, Dubai. Limping along the course, a businessman approached Barnett. He'd read his story on ESPN.com, he told him, and asked if he could walk with him. "Sure," Barnett said. "But I don't think I'm going to make it." The pain, he says, was excruciating, and he worried, knowing he still had another marathon to go. The stranger paced him, talking about everything but running and distracting him. Seven hours and 34 minutes later, Barnett had finished his sixth marathon.

En route to Sydney, Barnett tried to sleep on the plane. An hour into the flight, he woke with a start. His heart was fluttering; he was dizzy, disoriented. He worried that blood clots he had dealt with in 2012 had returned, but there wasn't much he could do. The plane was still cruising over the Indian Ocean, four hours from landing.

As the other runners began their final marathon, Barnett visited with a doctor in Sydney, who told him he'd likely suffered an anxiety attack on the flight. After replenishing his liquids with an IV drip, Barnett started the final marathon course at 3 a.m., two hours after the other competitors. Another stranger walked up to Barnett. "I'm going to run this with you," he told him. The stranger confessed that he'd never run a marathon before, but he was determined to help Barnett finish.

As the last competitor to complete the World Marathon Challenge, Barnett, who could barely run a mile in 2012, crossed the Australia finish line in six hours, 47 minutes and 32 seconds. His average time of 5 hours, 28 minutes was 18th out of the 24 men who completed all of the marathons.

"I didn't want to go back home a quitter," says Barnett. "I knew I couldn't face all the people we're telling to be winners [at the Dream Center]. When I got to that mindset, there was a numbness over my brain where I was on an autopilot of, 'just one more step, one more visual.'"

He made it: Barnett finished the final marathon in Australia with a time of 6:47.32. Courtesy of the Dream Center

After finishing, Barnett slept 12 hours straight. Back at home in Los Angeles, his doctor said he either strained or tore his patella -- time will tell if surgery is needed. For now, Barnett is grateful for the experience, and the amazing community he met along the way, including the WMC champion Mike Wardian, whose improbable 2:45:54 marathon average broke the previous record of 3:32. Wardian even ran a sub-3:00 marathon in Antarctica, in sub-zero temperatures.

All nine female competitors finished, including Beth Ann Telford, who is battling brain cancer. Chile's Silvana Camelio was the women's champion, with a 4:12:36 average marathon time, and Sinead Kane became the first blind person to complete the WMC, with guide John O'Regan by her side.

Former U.S. Olympic runner Ryan Hall averaged a 3:39 marathon, even after suffering a hip injury while running in Morocco. "This was a bit of a farewell tour for me because I never got to say goodbye to the marathon," Hall says. He left his shoes - literally -- at the Sydney finish line, a symbolic act to signify the end of his running career.

Hall also walked a few of the final Sydney laps alongside Barnett, whom he met and befriended through the Dream Center several years ago. In fact, Hall's WMC enrollment came after a text from Barnett, encouraging him to sign up. "I was so inspired by him," Hall says. "I don't think I've ever seen a runner want to finish a race as badly as he wanted to finish this race."

The pain and determination was worth it, Barnett says, as he raised $1.4 million for the Dream Center. "It was almost like the injury did more for people -- it related more to people than if everything had come easy to me," Barnett says. "Going through that, overcoming that pain, it turned out to be the high point."

Also see: Brain Cancer Survivor Conquers 7 Marathons on 7 Continents in 7 Days