The United States finished top of the swimming medal table at the World Aquatics Championships on Sunday, overcoming a slow start to its campaign in which several of its swimmers battled an outbreak of “acute gastroenteritis.”

The team capped its championships with a world record in the women’s 4x100-meter medley relay on Sunday, marking its ninth gold and 29th total medal as it consolidated first place ahead of Australia’s eight gold and 20 total medals.

The late surge meant that American swimmers had one more gold and nine more medals in total than they did in last year’s championships, even if their overall haul was significantly less than the 38 they won in 2023 and the 45 they claimed in 2022.

The team’s eventual success came after it had seemed diminished in the opening days, with its spokesperson telling the Associated Press that many of its swimmers were battling “acute gastroenteritis” they had contracted at a training camp in Thailand.

The USA’s initial struggles at the championship – it won only five gold medals in the opening six days – drew criticism from some of its former stars, particularly as it came a year after the Paris Olympics where it won its lowest tally of Olympic gold medals in the pool since 1988.