Michael Phelps has completed his comeback meet in international competition with a gold medal in the medley relay to cap off a Sunday night programme that started with Katie Ledecky setting her second world record within 24 hours at the Pan Pacific championships.
The 17-year-old Ledecky sliced almost six seconds off her own world mark by winning the 1500m freestyle in 15 minutes 28.36 seconds, a day after lowering her record in the 400m freestyle. She finished the meet with five gold medals.
''I knew it was my last race of the meet, and last race of the season,'' Ledecky said.
''I've had a really good season. I wanted to finish on a good note. I didn't want to walk away from the meet with a 'That was OK' feeling - I dug in deep for the last 50. Put it all in there.''
Phelps started his night with a narrow loss in the 200m medley, finishing two-hundredths of a second behind Kosuke Hagino's winning time of 1:56.02, but finished it off by swimming the butterfly leg of the medley relay and helping the US continue its domination of the event.
The 29-year-old Phelps, the most decorated Olympian in history, finished the meet with three gold medals - the 100m butterfly, 4x200m and medley relays - and silvers in the 200m IM and the 4x100m relay.
He said it was a good haul considering he only returned to competitive swimming in April after a year in retirement.
''It was, I think, a successful year,'' Phelps said.
''Obviously I'd like to win every single race I swim in, but, (that) doesn't always happen. It was a learning experience, that's most important.''
The medley relays were the last events on the programme after the open water section was postponed to August 31 in Maui because of concerns over water quality following three days of wet and windy weather on the Gold Coast.
Conditions were mild but sunny for the last day in the pool, when the medals were spread among five countries - with Brazil and Canada getting on top of the podium for the first time through Bruno Fratus' win in the 50m free and Ryan Cochrane's victory in the 800m.
The United States topped the medal standings with 14 gold and 40 overall, with Maya Dirado winning the women's 200m IM Sunday to go with the golds from Ledecky and the men's relay. Australia placed second with 10 gold and 26 medals overall, followed by Japan with seven gold medals and a total of 19.
Hagino, the silver medalist at last year's world championships, completed a Pan Pacs double in the IMs but put his win in the 200m down to Phelps being ''not in his best condition right now''.
Yasuhiro Koseki, meanwhile, won the 200m breaststroke in 2:08.57 to complete a 100-200m double and said: ''I'm so happy that I could prove Japanese breaststroke is so strong.''
Kanako Watanabe and Rie Kaneto finished 1-2 for Japan in the earlier women's 200m breaststroke.
Australian sisters Cate and Bronte Campbell repeated their 1-2 finish in the 100m free by taking gold and silver again in the 50m, and then Cate anchored the Aussies to victory over the United States and Canada in the women's medley relay.
Fratus had an eye on Rio 2016 when he won the 50 free in 21.44 seconds, relegating 33-year-old Anthony Irvin to second and his US team-mate Nathan Adrian to third place.
Adrian then joined Phelps, Matt Grevers and Kevin Cordes in winning the medley relay in 3:29.72, holding off Japan and Australia.
''This is the best relay to be in. We've had such a great tradition in this relay,'' Phelps said, before reflecting on how far he has come in four months.
''Today my body was hurting. I woke up this morning and I was in pain. After this morning's race and the nap I got, I felt pretty fresh. I felt good,'' he said.
''For my first real big international meet back, we accomplished everything we wanted to.
''We were able to find out some of the things I need to improve on over the next year, and things I want to improve on. It is frustrating at times, but that's usually how I respond well.
''This is going to be a fun year.''
Will Shane Cameron beat Kali Meehan on Saturday?