Michael Phelps wins 23rd gold medal after men's 4x100M medley victory

RIO DE JANEIRO – Michael Phelps hit the pool Saturday night for what could be his last race as an Olympian and he didn't let his country down.

Phelps put the United States ahead to stay on the butterfly leg of the 4x100 medley relay and Nathan Adrian finished it off, giving the most decorated athlete in Olympic history his 23rd career gold medal.

If that was the end, and Phelps insists it is, what a way to go out.

He would finish his career with 28 medals overall, having won five golds and a silver at these games.

Two-time gold medalist Ryan Murphy put the Americans out front with a world-record split on the backstroke -- it counts since he was leading off -- but Britain surged ahead on the breaststroke with its own world-record holder, Adam Peaty.

[Watch: Michael Phelps wins 23rd gold medal]

Phelps dove into the pool in second place.

He wouldn't be for long.

On the return lap, Phelps powered through the water with his whirling butterfly stroke, surging ahead of James Guy to pass off a lead to the anchor Adrian.

It wasn't in doubt after that. Adrian pulled away on the freestyle to win in an Olympic-record time of 3 minutes, 27.95 seconds.

The victory came just minutes after the women's medley relay gave the United States its 1,000th Olympic gold medal at the Summer Games.