Katie Ledecky went from an unknown high school sophomore in Bethesda, Md., to a household name Friday when she not only won the 800 free finals in an upset of hometown British favorite and reigning champ Rebecca Adlington, but nearly broke the world record.

Katie Ledecky went from an unknown high school sophomore in Bethesda, Md., to a household name Friday when she not only won the 800 free finals in an upset of hometown British favorite and reigning champ Rebecca Adlington, but nearly broke the world record.

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 (and 21st overall) that has just 24 hours to go, and he did so 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 today.

That’s a relay.

Friday’s swim 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 backstroker 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 as 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.

And just like that, the high school sophomore-to-be from Bethesda, Md., won her own gold medal.

“I didn’t really expect gold, but I’ll take it,” she said, smiling.

She lowered Janet Evans’ American record of 8:16.22 set on Aug. 20, 1989. Already the youngest swimmer on the U.S. team, Ledecky became the second-youngest American woman to win an individual gold medal.

Beth Botsford was 15 years and 62 days when she won the 100 backstroke at the 1996 Atlanta Games; Ledecky is 15 years and 139 days.

Evans tweeted out her congratulations to Ledecky after the race: “Amazing swim, so proud of her for bringing distance gold back to the US!”

Ledecky described Evans as someone she’s looked up to, having watched her races on the Internet. Evans won the 800 free at the 1988 Seoul Olympics — as a 16-year-old — and again in 1992 in Barcelona.

Ledecky seemingly came out of nowhere to claim a spot on the U.S. team, and she nearly took out a world record in her first Olympics.

“She was absolutely amazing,” said a gracious Adlington, who settled for bronze in 8:20.32. “That time is unbelievable. She has got a bright career ahead of her.

“To break that record is really cool and really special,” Ledecky said about Evans’ mark.

Mireia Belmonte Garcia of Spain took the silver in 8:18.76.

Ledecky watched Franklin and Phelps win gold medals before her only race of the Games.

“I got really pumped up when I saw that Missy and Michael had really good swims,” the youngster said. “I was ready to scream when I saw Missy’s race, but I kept it to myself and used it as extra energy.”

Ledecky dropped 5.15 seconds from her time of 8.19.78 at last month’s U.S. trials, when she broke the trials record and won by 2.09 seconds. She just missed making the team in the 400 free, having broken Evans’ national age-group record while finishing third.

But Ledecky’s big time drop combined with questions about the use of performance-enhancing drugs directed at 16-year-old Ye Shiwen of China after she won two golds at these Games prompted a reporter to ask the American if she was cheating.

“It’s totally false,” Ledecky answered calmly. “I just put in a lot of hard work this past year. Just progressively setting short-term and long-term goals. I’ve been dropping time progressively.”

But no one works as hard as 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.

Even though Phelps didn’t go as fast in the final as he did in the semifinals, he actually won by a relatively comfortable margin compared to his two previous Olympic wins in the 100 fly: four-hundredths of a second over Ian Crocker in 2004, then one-hundredth of a second — the closest race possible — against Cavic at the Beijing Games four years ago.

That was the victory that kept Phelps on course to win a historic eight gold medals in China.

This was about going out in style.

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.

That’s certainly the case with Franklin.

“Missy The Missile” has certainly lived up to her nickname, completing a sweep of the backstroke events in a time of 2 minutes, 4.06 seconds, easily eclipsing the record of 2:04.81 set by defending Olympic champion Kirsty Coventry at the 2009 worlds in a now-banned bodysuit.

“I could never dream for it to happen like that,” said Franklin, who also has a bronze in her first Olympics and one more race to go in the 4x100 medley relay.

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.

Cullen Jones of the United States took silver in 21.54, while Cielo was left with bronze in 21.59. 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.”