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 4x200-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.
Before the race, they all huddled together, fully aware of their role in history.
"I thanked those guys for helping me get to this moment," Phelps said. "I told those guys I wanted a big lead. I was like, 'You better give me a big lead going into the last lap,' and they gave it to me. I just wanted to hold on. I thanked them for being able to allow me to have this moment."
Berens handed off a lead of nearly 4 seconds to Phelps, who was extra cautious with the exchange, knowing the only way he could ruin this one was to get disqualified.
Lochte stood on the deck, waving his arms. Dwyer and Berens pumped their fists. And Phelps touched the wall for his first gold of the London Games with a cumulative time of 6 minutes, 59.70 seconds.
No one else was close. France's Yannick Agnel swam a faster final leg than Phelps, but it wasn't nearly good enough, his country taking silver in 7:02.77. China was far back in third at 7:06.30.
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."
Phelps has 15 golds in his career, six more than anyone else, to go along with two silvers and two bronzes. After failing to medal in his only race at the 2000 Sydney Games, he won six golds and two bronzes in Athens, followed by his epic eight gold medals in Beijing. And now the swan song, not nearly as epic but enough.
Latynina won nine golds, five silvers and four bronzes from 1956-64.
"You are now a complete legend!" the public-address announced bellowed, accompanied by the Foo Fighters' song "Best of You."
Phelps still has three more events in London before he retires, three more chances to establish a mark that will be hard for anyone to touch.
"It has been a pretty amazing career," the 27-year-old said, "but we still have a couple races to go."
Several fans held up a bedsheet with "PHELPS GREATEST OLYMPIAN EVER" handwritten on it.
Hard to argue with that, though this hasn't exactly been the farewell Phelps was hoping for -- a sluggish fourth-place finish in the 400 individual medley, a runner-up showing in the 4x100 free relay, then another silver in the 200 fly.
The 200 fly was a race he had not lost at either the Olympics or world championships since Sydney, when he finished fifth as an unknown 15-year-old just soaking up the moment, a kid with big dreams but no idea they would turn out like this.
Phelps, after leading the entire race, tried to glide into the wall instead of taking one more stroke. Le Clos took that extra stroke and beat Phelps by five-thousandths of a second.
"Obviously I would have liked to have a better outcome in the 200 fly," Phelps said. "I was on the receiving end of getting touched out. Chad swam a good race. I've gotten to know him a little over the last year. He's a hard worker, he's a tough competitor and he's a racer."
Le Clos pounded the water when he saw the "1" beside his name.
"He has always been an inspiration to me and a role model," le Clos said. "I've watched all his races a million times and I've run the commentary over and over. Now, I guess I can watch my race."
Phelps hung on the lane rope and buried his face in his hands, disgusted with himself for having squandered what looked like a sure gold. Le Clos won South Africa's second swimming gold of the games in a time of 1:52.96. Phelps finished in 1:53.01, while Japan's Takeshi Matsuda took the bronze in 1:53.21.
"It's obviously my last one," Phelps said. "I would have liked to win, but 1:53 flat isn't a terrible time. When you look at the picture of it, it's a decent time."
But the finish was a stunner, given that Phelps had won a memorable race at Beijing when a rival made the very same error. Milorad Cavic of Serbia thought he had the 100 fly in the bag after his final stroke, but Phelps made the split-second decision to get in one more stroke and slammed into the wall -- one-thousandth of a second ahead of Cavic.
This time, it was Phelps on the losing end. He was again denied a chance to become the first male swimmer to win the same individual event at three straight Olympics, though he can still do it in the 200 individual medley and the 100 butterfly.
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. He swam the anchor of the 4x100 free relay, but was chased down by Agnel after being handed a comfortable lead. Then he was fourth -- far behind Agnel -- in the 200 free.
"After that relay, my confidence went down," Lochte said. "Everyone just kept on telling me, 'You know what, you're better than that. Just forget about it and move on.' I didn't swim at all this morning, which I thought helped. I woke up this morning and I was back to myself. I was that happy-go-lucky guy, so I think that's what really helped me throughout the whole day."
In the first final of the night, American Allison Schmitt won the 200 freestyle with a dominating performance that left everyone else, including teammate Missy Franklin, battling for the other medals.
Schmitt won in an Olympic-record 1:53.61. France's Camille Muffat took silver in 1:55.58, almost a body length behind, while Bronte Barrett of Australia took the bronze over Franklin by a thousandth of a second. Barrett touched in 1:55.81. Franklin, who led after the first 50, was fourth in 1:55.82.
"I was just racing," said Schmitt, who is quietly becoming one of the stars of the pool. "I knew I had to kick it. I just look at that scoreboard and see 53 and first place. I couldn't be happier."
She captured her first career gold medal, to go along with a silver in the 400 free and a bronze in the 4x100 free relay.
The 17-year-old Franklin was denied her third medal of the games, one night after her gutsy victory in the 100 backstroke earned her a tweet-out from pop star Justin Bieber.
"I was trying to do the best that I can," said Franklin, who still has four more events in London. "I was in an incredible heat. I really wanted to go best time."
China's Ye Shiwen set an Olympic record to win her second gold of the London Games, adding the 200 individual medley title to a world-record performance in the 400 IM that sparked suspicions about doping. Everyone from her fellow swimmers to the International Olympic Committee have come to her defense, and she put aside any distractions to win again.
The questions didn't stop. The teenager was peppered with drug-related queries at her news conference, including a reporter asking her point-black if she had ever used banned substances.
"Absolutely not," Ye said through a translator.
The 16-year-old took the lead in the final lap and clocked 2:07.57, shaving 0.18 off her own mark set in Monday's semifinal. Alicia Coutts of Australia touched in 2:08.15 to take the silver medal and Caitlin Leverenz of the United States finished in 2:08.95 to take bronze.
Defending champion Stephanie Rice of Australia was fourth.
But this night was all about Phelps, who endured both gut-wrenching disappointment and thrilling triumph.
After losing the 200 fly, he retrieved his cap, went over to congratulate le Clos, and hustled out of the pool to get ready for the relay. Before that, Phelps had to return to the deck for a medal ceremony that he clearly would have preferred to skip. He bit his lip, leaned over to have the silver medal draped around his neck, and forced a weak smile.
It sure didn't feel like a celebration.
But the mood was much different when he came out with his teammates to accept gold for the relay. He bantered playfully with the crowd. He posed with an American flag. He propped up a chair trying to reach his mom and two sisters, sitting in the front row.
As Phelps lingered on the deck, doing television interviews, a crowd of U.S. supporters broke into a chant.
"Four more years! Four more years!"
But, really, what's left for someone who's already the greatest?