-- GOLD COAST, Australia -- Michael Phelps completed his comeback meet in international competition with a gold medal in the medley relay to cap off a Sunday night program that kicked off with Katie Ledecky setting her second world record within 24 hours at the Pan Pacific championships.
Phelps started his night with a narrow loss in the 200 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 U.S. 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 100 butterfly, 4x200 and medley relays -- and silvers in the 200 IM and the 4x100 relay.
He said it was a good haul considering he only returned to competitive swimming in April after 1 ½ years 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 program after the open water section was postponed to Aug. 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 50 free and Ryan Cochrane's victory in the 800.
Ledecky sliced almost six seconds off her own world mark in the women's 1,500-meter freestyle, winning in 15 minutes, 28.36 seconds to post her second world record in as many nights. The 17-year-old American improved her record in the 400 freestyle on Saturday by almost half a second.
The United States topped the medal standings with 14 gold and 40 overall, with Maya Dirado winning the women's 200 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 200 down to Phelps being "not in his best condition right now."
Yasuhiro Koseki, meanwhile, won the 200 breaststroke in 2:08.57 to complete a 100-200 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 200 breaststroke.
Australian sisters Cate and Bronte Campbell repeated their 1-2 finish in the 100 free by taking gold and silver again in the 50, 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 U.S. teammate 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."
The Associated Press contributed to this report.