Michael Phelps, left, and Ryan Lochte share a laugh on the podium at the USA Swimming Nationals, where Lochte edged Phelps by a half-second to win the 200-meter individual medley. (Harry How/Getty Images)

It’s a narrative that has played itself out so many times over the last decade: Michael Phelps vs. Ryan Lochte in a championship final.

The two swimmers have a combined 33 Olympic medals and 12 world records between them. As a pair, they owned the 2004, 2008 and 2012 Olympic Games. And they’ve largely done so going head-to-head.

On Sunday at USA Swimming Nationals, the Olympians stepped onto the starting blocks again. But for the first time in a long time, they did not step onto blocks side-by-side in the coveted center lanes, and they were not the favorites. Maybe they should have been.

Lochte and Phelps finished 1-2 in the men’s 200-meter individual medley on the final day in Irvine, Calif. Lochte won in 1 minutes 56.50 seconds to edge Phelps, who finished in 1:56.55.

The rest of the field trailed by more than a second.

“Being able to get back in the water again, for me being able to finish with this, it’s definitely better than where I was at the beginning of the meet,” Phelps said.

It was Lochte’s first win of the meet and a satisfying one against his longtime friend and rival. But not as satisfying as reminding himself that despite injuries — he’s recovering from a second medial collateral ligament tear in less than a year — and his aging 30-year-old body, he can still rise to the moment.

“This year’s been up and down, but I’m glad I got a win,” said Lochte, who finished second in the men’s 100 freestyle and third in the 200 backstroke earlier in the week.

Phelps didn’t take that final step to the top of the podium this week. It was the first time in 13 years he hadn’t done so.

He walks away with two medals, both silver, and a lot of work to do ahead of the Pan Pacific Championships held in Gold Coast, Australia, from Aug. 21 to 24.

Notes: Andrew Seliskar finished third in the “B” final after leading for the first 150 meters. Georgia’s Melanie Margalis won the women’s 200 IM (2:10.20), edging Stanford’s Maya DiRado (2:10.57), to qualify for her first national team.

Katie Ledecky scratched the 1,500 freestyle to rest and train ahead of Pan Pacs, a decision she and Coach Bruce Gemmell had anticipated making ahead of nationals.

In her absence, UCLA’s Katy Campbell won the mile event in 16:17.59. Former All-Met Swimmer of the Year Kaitlin Pawlowicz finished sixth (16.28.31), followed by Langley sophomore Isabella Rongione (16.32.25). Oakton’s Megan Byrnes was 11th (16.44.43).

Sterling native Matt McLean, 26, finished second in the men’s 800 freestyle to Michael McBroom, 7:55.78 to 7:49.66. McLean won the 400 freestyle Saturday.

Simone Manuel, 18, won the women’s 50 freestyle in a lightning 24.56. Natalie Coughlin, a 12-time Olympic medalist, finished sixth to miss making a 13th national team in 14 years.

Anthony Ervin, 33, won the men’s freestyle in 21.55.