LONDON — Michael Phelps lingered on the blocks, not wanting to make another shocking blunder. The 19th medal was his. All he had to do was avoid a DQ, then set off on what amounted to four victory laps.
Down and back, then down and back again, the roars getting louder with each stroke.
When Phelps touched the wall, he finally had gold at his final Olympics. And a record for the ages.
Phelps swam into history with a lot of help from his friends, taking down the last major record that wasn’t his alone. He took the anchor leg for the United States in a gold medal-winning performance of the 4 x 200-meter freestyle relay Tuesday night, earning the 19th Olympic medal of his brilliant career, and the 15th gold.
A more appropriate color.
‘‘I’ve put my mind to doing something that nobody had ever done before,’’ Phelps said. ‘‘This has been an amazing ride.’’
About an hour earlier, Phelps took one of his most frustrating defeats at the pool, blowing it at the finish and settling for silver in his signature event, the 200 butterfly.
That tied the record for career medals held by Soviet gymnast Larisa Latynina, but it was hardly a triumphant moment. Phelps slung away his cap in disgust and struggled to force a smile at the medal ceremony.
But any disappointment from that race was gone by the time he dived in the water on the relay, having been staked to a huge lead by teammates Ryan Lochte, Conor Dwyer, and Ricky Berens.
No one came close. France’s Yannick Agnel swam a faster final leg than Phelps, but it wasn’t nearly good enough, his country taking silver. China was far back in third.
Phelps might have backed into the record a bit by failing to win any of his first three events at these Games, but there’s no denying his legacy as one of the greatest Olympians ever — if not the greatest.
‘‘The legacy he has left behind for swimming is fantastic,’’ said South African Chad le Clos, the guy who beat him in the butterfly. ‘‘Even in Africa, everyone knows Michael Phelps.’’
Lochte was also feeling better about himself, having struggled in two straight events after opening the Olympics with a dominating win in the 400 individual medley.