TOKYO — The last quasi-athletic motion of Caeleb Dressel’s Tokyo Olympics was a vein-popping, full-body muscle flex accompanied by a feral howl pointed in the direction of the Team USA cheering section at Tokyo Aquatics Centre. The last leg of the last race of the last day of this grueling swim meet had ended in redemptive triumph for the Americans, and before anyone could add up the totals or hang another gold medal on his neck, Dressel needed some help staying on his feet.

He wobbled and drooped, propped up by teammate Ryan Murphy, then eventually dropped into a seated position on the deck behind the starting blocks of Lane 1. At that moment, Dressel was a living metaphor for the entire U.S. Olympic swim team: battered, depleted but still somehow on top of the world.

With four near-perfect swims from their outside lane, the U.S. men’s 4x100-meter medley relay squad won gold in the final race of the Olympics — a victory that kept alive the Americans’ unblemished record in that event, gave Dressel a fifth gold medal at these Games and secured Team USA’s place at the top of the swimming medal standings despite feeling the heat from the relentless Australians for the past nine days.

“I wouldn’t change a single thing,” said Dressel, whose leg of the medley produced the fastest butterfly relay split in history (49.03 seconds). “I’m proud of myself. I think I reached what my potential was here at these Games. Give myself a pat on the back, and then I just want to go home and put it away and go forward.”

Together, Murphy (backstroke), Michael Andrew (breaststroke), Dressel (butterfly) and Zach Apple (freestyle) completed their eight lengths of the pool in a world record time of 3 minutes 26.78 seconds, giving Team USA its 11th gold of the meet, just two more than Australia, and 30th overall medal, 10 ahead of the Aussies.

It wasn’t the complete and utter dominance the Americans are used to enjoying in the Olympics, but at the end of a meet in which every triumph in one event seemed to be countered by a disaster in another, they gladly took it.

“Thank God it’s over,” Abbey Weitzeil said after her freestyle anchor leg of the women’s 4x100 medley relay, in which the U.S. quartet that also included Regan Smith (back), Lydia Jacoby (breast) and Torri Huske (fly) took silver to Australia’s gold by 13-hundreths of a second. Weitzeil didn’t specify whether she meant the race, her 50 free/relay double or the entire Olympic swim meet.

Nine years ago in London, Team USA out-gold-medaled Australia in the pool by a score of 16-1. Five years ago in Rio de Janeiro, the Americans’ winning margin was 16-3.

The back-to-back drubbings suggested the long and colorful USA-vs.-Australia rivalry was all but extinguished and sparked some soul searching ahead of Tokyo on the part of the Aussies, who among other things shifted their Olympic trials from March to June to better maintain their athletes’ edge.

In Tokyo, the rivalry roared back to life, fueled by an Australian team that delivered punch after punch to the Americans and took every counterpunch to the final bell. The Aussies were paced by sprinter Emma McKeon, who took home seven medals — four gold, three bronze — the most by a female swimmer at a single Games and tied for the most by a woman in any sport, joining Russian gymnast Maria Gorokhovskaya, who won seven medals in 1952.

“It’s amazing,” said McKeon, whose 10 career Olympics medals makes her the most decorated Australian swimmer in history. “A pretty cool thing to be a part of.”

Notice has been served: Australia is back. The generous read of this meet’s results is that Tokyo 2020 found the Aussies at a high point in a development cycle and the Americans at a lower point. The alarmist read: It’s not a cycle but a clear trend, and Australia is getting ready to zoom past Team USA in Paris.

“We’re not like the Americans who make a big deal about it, but we do definitely tap each other on the back, and we’re all really proud of each other,” said Australia’s Kaylee McKeown, who swept the golds in the 100- and 200-meter backstrokes. “It’s an amazing team.”

For every gold medal the Americans figured to win here but didn’t, they got another they never expected. In distance freestyler Bobby Finke, in fact, they got two. On Sunday, in the final of the men’s 1,500-meter freestyle, Finke duplicated his frantic, improbable, comeback swim from the 800 free earlier in the week — only even better this time.

After stalking leader Germany’s Florian Wellbrock for 29 lengths of the pool, Finke made his move at the final wall, dashing off a scorching final 50 of 25.78 seconds — a superhuman split at the end of such a lengthy race — to win gold by more than a second.

“Just tried to hold on,” Finke said, “and sprint my butt off at the end.”

How fast is a 25.78 at the end of a 1,500? None of the eight finalists in the men’s 200 free, a race of just four lengths instead of 30, closed that fast or even got within a half-second of Finke’s split.

As a result, the Americans emerged with an unexpected sweep — or halfway unexpected, anyway — of the distance freestyles, with Katie Ledecky earning her sixth and seventh career golds by winning the women’s 800 and 1,500. Before Finke arrived in Tokyo, the U.S. men hadn’t won a freestyle race of 400, 800 or 1,500 meters at any Olympics or world championships since 1984.

For Dressel, Sunday brought his 11th trip to the starting blocks in Tokyo, the medley relay his 12th — an aggressive meet program that required careful management and restraint.

Swimming fans may have been salivating for a seven-gold-medal meet for Dressel, but that was never likely in the first place, mainly because the American relays couldn’t be counted on to win.

Team USA resisted using Dressel in the men’s 4x200 free relay — despite the fact he had posted a time in the prelims at the Olympic trials in Omaha for the sole purpose of becoming eligible for that relay in Tokyo — and were rewarded with a fourth-place finish, missing the podium in that event for the first time in history.

Another medal chance evaporated in a botched mixed medley relay — a race making its Olympic debut here — in which unsound lineup choices and an apparent lack of trust in the team’s male breaststrokers produced a fifth-place finish despite Dressel’s hard-charging freestyle anchor leg.

Perhaps Team USA needs to do some soul searching ahead of Paris 2024. The Americans won just two of the seven relays in Tokyo, after winning five of six in Rio. The women, in particular, were outperformed by their counterparts from down under: They failed to win gold in any of the three women’s relays, and just two American female swimmers (Ledecky and Jacoby) won individual golds. They did, however, take silver and bronze in a four events.

For Dressel, adding up his victories required all the fingers on one hand. He came into the meet facing massive expectations, and he met them all.

Dressel’s victory Sunday in the 50 free — by an unfathomable 0.48, the largest margin of victory in that event in Olympic history — gave him three individual golds in the Tokyo meet, a number surpassed in a single Olympics by just two men: Michael Phelps and Mark Spitz. As far as swimming company goes, that’s as elite as it gets.

“It’s not about the medals,” Dressel said. “Nothing comes of that if you don’t learn anything from moments lile this. I feel like I can walk away from this meet a better swimmer, not because of the hardware I’m bringing home. I can be proud of every swim, every effort I put into the water, every mental approach to every single race I can be proud of that.

“I was nervous before races. Every morning I’d wake up, the first words out of my mouth weren’t, ‘Oh, I’m so excited.’ Sometimes it was, ‘Oh, [expletive], this is going to suck today.”

Dressel was part of two world records in Tokyo — his 100 fly and the medley relay — and two other Olympic records. And until Dressel, no male swimmer, not even Phelps or Spitz, had ever pulled off the sprint Triple Crown in an Olympics: golds in the 50 free, 100 free and 100 fly.

Dressel has been keeping a journal while in Tokyo, documenting not only his practices and races, but also his feelings and experiences at the Games. He figured he would save the final entry for the plane ride home, if only because, as he said, “I can barely raise my arms right now.”

As much joy as the Olympics brought him, it may not have been nearly as much joy as being finished.

“It’s a relief,” he said. “This is not easy. Some parts are extremely enjoyable. I would say the majority of them are not. You can’t sleep right, can’t nap. You’re shaking all the time, don’t eat. I’ve probably lost 10 pounds this week. It’s a lot of stress you put on your body. It’s not the most enjoyable process. But it is worth it. And I’m really glad to be done.”