RIO DE JANEIRO (AP) — A stunner at the Rio Olympics: Michael Phelps was beaten.
Rather handily at that.
The most decorated athlete in Olympic history couldn't pull off one of his patented comebacks in the 100-meter butterfly, easily held off by a swimmer a decade younger.
Twenty-one-year-old Joseph Schooling of Singapore got off to a blistering start, building a lead that not even Phelps could overcome.
After winning four gold medals at these games and looking unbeatable, Phelps finally ran out of steam in what was the final individual race of his career unless he decides to come out of retirement again.
The 31-year-old Phelps still has a chance to leave Rio with 23 golds in his career. But he'll have to do with some help from his teammates, swimming in the butterfly leg of the 400 medley relay on the final night of swimming Saturday.
Phelps wound up in a three-way tie for silver along with two longtime rivals, Chad le Clos of South Africa and Laszlo Cseh of Hungary. They all touched in 51.14 — a half-body length behind Schooling's winning time of 50.39.
"A three-way tie is pretty wild," Phelps said. "Joe is tough. Hats off to him, he swam a great race. It's kind of special and a decent way to finish my last individual race."
Phelps quickly swam over to congratulate Schooling, who seemed stunned by what he had done.
"It hasn't really sunk in yet," Schooling said. "I'm sorry if I don't seem like I'm full of emotions right now. I don't know what to believe, like, whether I actually did it or I'm still preparing for my race."
Phelps, he added, is "a guy that will go down in our history books as the greatest of all time of any sport. I'm just honored and glad to have that moment and that privilege to race alongside Michael and Chad and all those guys."
While Phelps' loss left the crowd in shock, Katie Ledecky got them on their feet again with another dominating performance, handily breaking the world record in the 800 freestyle.
And two other Americans won gold, too. Anthony Ervin capped a remarkable personal journey with a gold in the 50 freestyle — 16 years after he won his first individual gold in the same event at the Sydney Games. And Maya DiRado knocked off the Iron Lady in the 200 backstroke, pulling off a furious rally on the final lap to beat Katinka Hosszu. Bronze went to Canada's Hilary Caldwell.
Ledecky joined Debbie Meyer as the only women to sweep the three longer freestyle events at the same Olympics. Meyer took the 200, 400 and 800 at the 1968 Mexico Games, and Ledecky matched that performance with a couple of world records as well.
Ledecky was merely racing the clock as she powered away from the field to touch in 8 minutes, 4.79 seconds, eclipsing the mark of 8:06.68 that she set at a grand prix meet in Texas back in January.
Then, Ledecky played the waiting game, hanging on the rope for a while to let the rest of the field finish.
Jazz Karlin finally touched in 8:16.17 to claim the silver, just ahead of Hungary's Boglarka Kapas grabbing the bronze in 8:16.37.
Some 23 seconds after Ledecky touched the wall, the last of the eight finalists chugged to the end of the grueling race.
Ledecky was barely breathing hard.
"I hit all my goals right on the nose this week," she said.
Ledecky also became only the third American woman to win four gold medals in a single Olympics, following fellow swimmers Amy Van Dyken and Missy Franklin.
While Ledecky, at 19, is the youngest member of the U.S. team, Ervin is the oldest at 35.
In the blink of an eye, Ervin went from one end of the pool to the other in a furious dash, edging the defending Olympic champion, Florent Manaudou of France, by a mere hundredth of a second. Another American, Nathan Adrian, took the bronze.
Ervin won his first gold at the 2000 Sydney Olympics, tying teammate Gary Hall Jr. for the top spot. Then, Ervin walked away from swimming, skipping the next two Olympics while he embarked on a journey to find his purpose in life.
Turns out, it was swimming all along.
Ervin returned to make the American team in 2012, but failed to win a medal in London. Now, improbably, he's back on the top of the podium again.
DiRado's upset denied Hosszu a fourth gold in Rio, and capped off a remarkable one-and-done Olympics for the American.
She's already got a job lined up in Atlanta after the Olympics and made it clear she would be retiring no matter the results. She certainly has nothing to complain about after winning two golds, a silver and a bronze in Rio.
"This whole day has been kind of crazy because it's all of these little last things that I've gotten to do, like my last warmup with the girls at the training pool today," DiRado said. "I wrote my parents an email this morning just saying thank you and I started bawling on my bed and then my roommates came in and comforted me. I tried to keep it all under control, but there's been a lot of tears these last 24 hours."
Follow Paul Newberry on Twitter at www.twitter.com/pnewberry1963 . His work can be found at http://bigstory.ap.org/content/paul-newberry .