LONDON — Michael Phelps is turning his final Olympics into quite a victory lap, and don’t fret about American swimming after he’s gone.

Led by a pair of high schoolers, the post-Phelps era will be in very good hands.

In what amounted to a symbolic changing of the guard Friday, Phelps claimed the 17th gold medal of a career that has just 24 hours to go — on the same night one teenager, Missy Franklin, broke a world record in the backstroke and another, Katie Ledecky, took down a hallowed American mark that was set nearly eight years before she was born.

“This has sort of turned into the youth Olympics,” Franklin said. “There’s so many members of the team that are coming up this year that are going to carry on this incredible generation.”

Incredible, indeed.

His long arms whirling through the water, Phelps was seventh at the turn in 100-meter butterfly — it always takes him a while to get up to speed — but he brought it home like a champion. That, in a sense, sums up his Olympics farewell. He got off to a sluggish start but has three victories in the past four days, and it’s almost certain he’ll take home one more gold Saturday.

That’s a relay.

This was the final race he’ll do alone.

“I’m just happy that the last one was a win,” said Phelps, who will likely fade into retirement with twice as many golds as anyone else. “That’s all I really wanted coming into the night.”

He’ll finish up swimming the butterfly leg of 4x100 medley relay, an event the U.S. men have never lost. That streak should carry right on with the Americans sending out an imposing quartet that includes three gold medalists (Phelps, freestyler Nathan Adrian and back- stroker Matt Grevers), plus a guy who won bronze (breaststroker Brendan Hansen).

It’s unfathomable to think the Phelps era could end with anything less than a performance that puts him atop the podium one last time, gold medal No. 18 around his neck.

“I don’t think Michael is going to let anything go wrong in that race,” said Eric Shanteau, who swam the relay for the U.S. in the prelims.

Just minutes before Phelps took center stage at the Olympic Aquatics Centre, Franklin set a world record in the 200 backstroke, the 17-year-old’s third gold in London. Another American teen, 19-year-old Elizabeth Beisel, claimed the bronze in that race.

“I can’t believe what just happened,” said Franklin, who had dedicated her Olympics to victims of the theater shooting not far from her Colorado home. “In that last 25, I knew I was giving it everything I had because I couldn’t feel my arms and legs and I was just trying to get my hand to the wall as fast I could.”

Right after Phelps was done, Ledecky — the youngest member of the U.S. team at 15 — nearly broke the world record to win gold in the 800 freestyle, denying Britain’s Rebecca Adlington a repeat before her home fans. Adlington settled for bronze in a race Ledecky dominated from start to finish, falling off record pace only in the last 15 meters.

But no one has dominated like Phelps, who increased his career overall medal total to 21.

“He’s the king of the Olympics Games,” said his butterfly rival, Serbia’s Milorad Cavic.

Phelps slammed the wall in 51.21 seconds for payback against the guy who edged him in the 200 fly, Chad le Clos of South Africa. No gliding into this finish, the move that cost Phelps the gold in their first meeting.

“My start of the meet wasn’t what we wanted, but I seemed to pick up some steam at the end of the meet,” Phelps said.

He’s still in race mode, at least for one more day. Phelps covered the final 50 in 26.86. Le Clos was the only other swimmer to break 27, and three guys couldn’t go under 28.

“I thought it would hit me a lot harder than what it is right now,” Phelps said. “I guess a lot of those emotions haven’t really come through my brain over the last week. Once I’m done and once tomorrow is over, I think there’s going to be a lot more emotion that really comes out.”

France won its fourth gold at the pool, building on its best showing ever and denying an American sweep of the night. Florent Manaudou — younger brother of 2004 gold medalist Laure Manaudou — shocked defending Olympic champion and world-record holder Cesar Cielo of Brazil in the 50 freestyle.

Manaudou touched in 21.34 and pounded the water out in Lane 7, then got a big hug from his sister as soon as he climbed from the pool. Cullen Jones of the United States took silver in 21.54, while Cielo was left with bronze in 21.59.

Anthony Ervin, the 2000 Olympic champion who came back from an eight-year retirement, finished fifth after getting off to a poor start.

“I’m tired,” said Cielo, still only 25 but the world’s top sprinter for the last four years. “Age takes its effect.”

Jones claimed the first individual medal of his career, and vowed to come back even stronger at the 2016 Rio Games.

“I was dreaming in gold and I really wanted to get first, but it wasn’t in the cards this time,” Jones said. “I’ll have to live with silver, and that’s enough motivation for another four years.”

Ervin seemed flustered by a slight delay in the start because of a woman yelling in the stands. He was slowest off the blocks — a crucial miscue in the one-lap dash — and never caught up. He was timed in 21.78, leaving him 0.19 behind Cielo for a spot on the podium.

Still, it’s been quite a journey for the eclectic swimmer, who shared the 50 free title with Gary Hall Jr. at the Sydney Olympics, won a world title the following year, then stunningly walked away from the sport at age 22. Ervin was gone for eight years, selling off his gold medal to aid victims of the Indian Ocean tsunami, playing in a band, finishing college and never staying in one place for too long.

Just one year after coming back, the 31-year-old nearly got another Olympic medal.

“Being here is my own form of redemption,” he said. “What’s next? I’m going to have a nice dinner with my friends and family, people I really care about. Without them, this could not have happened.”