BUDAPEST, Hungary (AP) Katie Ledecky reached for the wall.
Someone else was already there.
For the first time ever at the world championships, Ledecky knows what it's like to lose.
Bidding to become only the second female swimmer to win six golds at a single worlds, Ledecky settled for silver in the 200-meter freestyle Wednesday evening when Italy's Federica Pellegrini surged to a stunning victory on the final lap.
Pellegrini, the world-record holder, avenged a close defeat at the hands of Ledecky two years ago in Kazan, Russia. This time, it was the Italian touching first in 1 minute, 54.73 seconds.
Ledecky and Australia's Emma McKeon tied for the silver at 1:55.18.
''I just didn't really have it today,'' Ledecky said. ''I can't complain really with the silver medal.''
While Pellegrini covered her mouth in delight and climbed atop a lane rope to celebrate, Ledecky stared blankly at the scoreboard.
She had never seen a ''2'' beside her name at the world championships.
It was there in Budapest, where Ledecky's unbeaten streak in the second-biggest swimming competition after the Olympics finally ended.
''I didn't really feel at the end that I had that extra gear that I normally have,'' said the 20-year-old Stanford student from the Washington, D.C., suburbs.
Ledecky had been 12 of 12 over the last three world championships, including three golds in this stately European capital. But her most audacious schedule yet - six freestyle events covering distances ranging from 100 meters (on a relay) to 1,500 (the grueling metric mile) - finally caught up with her along the banks of the Danube.
Missy Franklin will remain the only female swimmer to win a half-dozen events at worlds, while Ledecky can take comfort in being the winningest female swimmer overall. Twelve golds leave her trailing only fellow Americans Michael Phelps and Ryan Lochte for the most victories.
Now she's got a silver, too.
''It happens,'' said Ledecky, who will be a heavy gold medal favorite in her last two events, the 4x200 free relay and the 800 free. ''It happens to every athlete at some point. I know this race will really motivate me moving forward and the rest of the week as well.''
Of course, losing to Pellegrini was hardly an embarrassment.
The 28-year-old became the first swimmer in the history of the championship to capture seven medals in a single individual event. Pellegrini's incredible run in the 200 free began at the 2005 worlds in Montreal, where she grabbed a silver. She was third in 2007 at Melbourne, and then had back-to-back victories, including a world-record performance at Rome in 2009 (1:52.98) that still stands from the rubber-suit era.
Pellegrini was runner-up at the last two worlds, finishing behind Franklin in 2013 at Barcelona and Ledecky two years ago.
On Wednesday, the Italian was back on top in what she called the last 200 of her career.
''I honestly thought the one to win the race would be Katie,'' Pellegrini said. ''It wasn't.''
McKeon got off to a blistering start, making the first turn more than a half-second below the record pace, while Ledecky - normally a slow starter because of her distance background - was lagging in fifth.
Ledecky turned on the speed and was just one-hundredth of a second behind the Aussie when they made the final flip. But the two leaders, having spent so much energy dueling each other, didn't have anything left for the final lap.
Pellegrini sure did.
Her closing 50 was a blistering 28.82 - nearly a full second faster than both Ledecky and McKeon.
''Everything seemed to be in slow motion to me in the water,'' Pellegrini said. ''At 150 meters on the turn we were all there, so I closed my eyes.''
She paused for a moment, as if trying to convince herself that it really happened.
''I didn't believe I would make it.'' Pellegrini said. ''I still can't believe it.''
She wasn't the only Italian atop of the medal podium. Gabriele Detti rallied to win the men's 800 free, racing past both teammate Gregorio Paltrinieri and Poland's Wojciech Wojdak after those two put on a thrilling back-and-forth duel.
Detti finished in 7:40.77, holding off Wojdak by less than a second while Paltrinieri faded to bronze.
Standing in the aisles and screaming furiously, the packed house at Duna Arena came to cheer for Katinka Hosszu, who also was in the 200 free final, and Laszlo Cseh, one of the favorites in the 200 butterfly.
Hosszu wasn't a factor, finishing seventh. Cseh rallied furiously over the final lap but couldn't catch South African star Chad le Clos, who took the gold in 1:53.33.
Cseh settled for silver, though that didn't prevent him from pausing on deck to salute the raucous crowd. The bronze went to Japan's Daiya Seto.
Britain's Adam Peaty cruised to victory in the 50 breaststroke, a non-Olympic event, but his time was a bit of a letdown. After breaking the world record in both the preliminaries and the semifinals - the latter in 25.95 - Peaty settled for only the second-fastest time ever (25.99) in the final. Brazil's Joao Gomes Junior claimed the silver and South Africa's Cameron van der Burgh took bronze.
After Ledecky's disappointment, the U.S. finished on a strong note with its second world record of the day in the 4x100 mixed medley relay. Matt Grevers, Lilly King, Caeleb Dressel and Simone Manuel won gold with a time of 3:38.56, easily beating the mark of 3:40.28 put up by an entirely different U.S. foursome - Ryan Murphy, Kevin Cordes, Kelsi Worrell and Mallory Comerford - in the morning preliminaries.
Australia took the silver, while Canada and China tied for bronze in an event that will be part of the Olympics for the first time in Tokyo.
''It's pretty cool,'' Grevers said, ''that we had two relays that would've won tonight.''
Follow Paul Newberry on Twitter at www.twitter.com/pnewberry1963 . His work can be found at https://apnews.com/search/paul%20newberry
For more AP swimming coverage: https://apnews.com/tag/Swimming