LONDON – It wasn’t the script Michael Phelps would have chosen, but there still were tears of joy at the end.

With a silver medal in the 200-meter butterfly and a gold medal in the 4x200-meter freestyle relay Tuesday, Phelps became the most decorated Olympian of all time.

“I’d put my mind on doing something that nobody had ever done before,” Phelps said. “And there was nothing that was going to stand in my way of being the first Michael Phelps. That’s what I said all along, and this has been an amazing ride.”

The ride to 19 Olympic medals has taken many twists and turns, perhaps none more than at this Olympic Games. In his four races, Phelps has finished out of the medals once, won two silvers and one gold. While those mixed results seem to detract from his overall achievement, they also point to just how incredible Phelps’ medal total is.

“It makes me appreciate it more,” said Phelps’ coach, Bob Bowman. “I thought it used to be easy. Now it’s like, ‘Let’s just get a medal.’ It underscores how difficult it is to win a medal of any color at this event. And it’s getting harder and harder.”

The challenges to U.S. supremacy in swimming are coming from all corners at this Games – China, South Africa and France especially.

In the 200 fly Tuesday, Phelps lost to 20-year-old Chad le Clos of South Africa, who considers Phelps, 27, his hero and role model.

He has Phelps’ 2008 Olympic win in the 100-meter butterfly on his laptop so he can watch it repeatedly. On Tuesday, when le Clos out-touched Phelps with a more well-timed stroke at the finish, it was reminiscent of Phelps’ by-a-fingernail victory in that 2008 race.

“I guess now I can actually watch my own race,” said le Clos, who beat Phelps by five-hundredths of a second.

He added: “I’m his biggest fan. He’s definitely the greatest Olympian of all time. Just to be here and race him in the final was an honor in itself.”

As le Clos and Phelps walked around the pool deck after receiving their medals, Phelps was advising the younger swimmer on where to walk and how to hold his medal for photographers. He also was telling him to enjoy the moment.

It’s a ritual Phelps knows better than anyone. He won six gold and two bronze medals at the 2004 Olympics, a record eight golds at the 2008 Games and now has three medals in London. He has three races left – the 200-meter individual medley, 100-meter butterfly and 4x100-meter medley relay.

Phelps will swim the 200 IM preliminaries on Wednesday morning.

“There are a lot of emotions that are going through my head right now, and there are still other races,” he said after winning medal No. 19, the 4x200 freestyle relay gold.

To prepare for the relay, he had to rebound quickly from the 200 fly loss, a heartbreaker since the 200 fly is a special event not just for him but his family.

His older sister Whitney finished sixth in the 200 fly at the 1996 U.S. Olympic Team Trials. Four years later, Phelps made his Olympic debut, at age 15, in the 200 fly, finishing fifth. He set his first world record and won his first world title in the event in 2001 and had not lost in it at an Olympics or world championships since.

He blamed his loss Tuesday on himself, saying he had not been sharp enough in practices on the finish.

“I tried to shut that out of my head and put it behind me and get ready for this (4x200) relay,” he said.

Swimming anchor, he asked his relay teammates -- Ryan Lochte, Conor Dwyer and Ricky Berens -- to give him as big a lead as possible, since the last swimmer for France would be newly minted 200 free Olympic champion Yannick Agnel of France.

His teammates did indeed provide him a comfortable lead, then Phelps swam the second-fastest leg of the field (one minute, 44.05 seconds), behind only Agnel, to capture the victory and another lofty spot in the Olympic record books.

“Records are meant to be broken,” Berens said, “but I’ll give that one a long time in the record books.”

Asked if Phelps’ mark would be possible to break, Lochte, who swims in as many events as Phelps, said: “It’s definitely possible. But I’d have to swim a lot more Olympics.”

Phelps passed Soviet gymnast Larysa Latynina, who won 18 medals from 1956-64. Latynina medaled in 18 of the 19 Olympic events in which she competed. Phelps has medaled in 19 of 21.

“I just think it speaks to his consistency,” Bowman said. “And the fact that 15 of those are gold medals speaks to the quality of it.”

As he swam the last 25 meters of his relay leg, Phelps was smiling, the first time he’s done that in an Olympic race, he said. After the race, in an on-deck huddle with his relay teammates, he thanked them “for helping me get to this moment.” He cried on the medals podium.

“I’m going to attempt to sleep tonight,” he said. “I’m not sure it’s going to be possible.”

Vicki Michaelis, who covered the past six Olympic Games as USA TODAY’s lead Olympics writer, is the Carmical Distinguished Professor of Sports Journalism at the University of Georgia.