And Brazil breathed a collective sigh of relief.
The Olympic torch was extinguished here Sunday, officially ending the first Games in South America. Rio marked the occasion with a joyful closing ceremony meant to celebrate a city and a people that defied predictions and pulled off a scaled-back Olympics amid economic and political turmoil.
The competition took place as scheduled and there were no major security incidents if you don't count the one fabricated by American swimmers.
"We did it. We made it," Carlos Nuzman, president of the Rio 2016 Organizing Committee, said during the ceremony. "It was seven years of a lot of struggle and work, but it was worth it. Every minute. Organizing the Games in Rio was a challenge. A successful challenge."
Rather than dwell on petty crime, swamp-colored diving pools and lackluster ticket sales, International Olympic Committee President Thomas Bach praised Rio's hospitality during a rain-soaked closing ceremony at the famed Maracana Stadium. Calling it "a marvelous Olympic Games in a marvelous city," he told the city's residents that they had reason to be happy.
"During these last 16 days, a united Brazil entertained the world with unforgettable and emotional moments of pure happiness despite the rather difficult surrounding environment," Bach said, moments after handing over the Olympic flag to the governor of Tokyo, which will host the Games in 2020.
In the months leading up to the Olympics, Rio's water quality and concerns about the mosquito-borne Zika virus dominated headlines, with some questioning whether the event should be canceled or moved. An Associated Press report suggested ingesting as little as three teaspoons of water from Guanabara Bay, where the sailing events took place, could cause serious stomach and respiratory illnesses.
When those fears failed to materialize, the Rio Games easily cleared the low bar established for its success. Unfinished venues, uninhabitable athletes' dormitories and inconsistent bus service mean little to a host city's legacy if the made-for-TV spectacle comes through with memorable performances from icons like Usain Bolt, Michael Phelps and Simone Biles.
The U.S. Olympic Committee, which had backed Chicago's failed bid to host these Games, also praised Rio organizers for their hospitality and downplayed any problems.
"We absolutely had some challenges, but the truth is, we have challenges in every Games," USOC CEO Scott Blackmun said. "I'm so proud of our team... for taking whatever was dealt and just making the best of it."
Team USA's biggest challenge, of course, was one of its own making. U.S. swimmer Ryan Lochte and three teammates hijacked the second week of the Games with an improbable story about being robbed at gunpoint. The tale quickly escalated into an international incident, as police concluded Lochte had lied, and they temporarily barred his teammates from leaving the country.
Lochte, who left Rio before the law-enforcement investigation ended, later apologized for exaggerating his story.
By that time, however, his lie already had captivated the world for days, stealing the spotlight from other athletes and humiliating a host city that was already sensitive about its reputation as a crime-infested oceanfront metropolis. While athletes repeatedly said Lochte's situation hadn't tainted their experience, the USOC was still expressing regret over the incident in the hours before the closing ceremony.
Lochte and his three fellow swimmers will face disciplinary action from the USOC, though Blackmun declined to discuss any potential penalties.
"I think we all understand that they let down our athletes, they let down Americans and they really let down our hosts in Rio who did such a wonderful job and we really feel badly about that," Blackmun said. "We understand that the things that were said about the people of Rio just weren't true."
Lochte's behavior tarnishes what is otherwise the U.S. team's best performance at a non-boycotted Games in more than a century. It won 121 medals during the 17-day competition, including 46 gold. China finished second with 70 total medals, while Britain was third with 67.
The count includes the gold medal won Sunday by Bulls star Jimmy Butler in basketball and Wheaton native Thomas Jaeschke's bronze in men's volleyball.
The U.S. team's performance was somewhat surprising, considering about two-thirds of its members were first-time Olympians. And after the U.S. women's soccer team and wrestler Jordan Burroughs — considered locks to top the podium here — lost in thequarterfinal rounds, some doubted the Americans could match the 46 gold medals collected four years ago in London.
"To be really candid, we weren't sure we were going to have that kind of success coming in," Blackmun said. "We had a fair amount of uncertainty, and I've never been more proud of a team with the way they came together."
USOC officials credited lower-profile sports for boosting the medal count, specifically citing triathlon winner Gwen Jorgensen of Waukesha, Wis., and the equestrian team for their strong performances. The U.S. riders won three medals here, including a silver in the team jumping competition led by Chicagoan Kent Farrington.
But it was the U.S. women who dominated these Olympics, winning a record-breaking 61 medals. If the U.S. women were their own country, they would have finished fourth overall in the medal table and tied for second with Britain in gold medals.
In a nod to the women's performance here, the U.S. team selected Biles to carry the flag in the closing ceremony. The 19-year-old gymnast owned the competition here, becoming the first American gymnast to win four gold medals at a single Games.
An undisputed face of these Games, Biles spent much of the closing ceremony granting requests to pose for selfies with athletes from other countries.
"Every single day that I've had here is like a dream come true and it just keeps getting better," Biles said before the ceremony. "I don't know how I've been so lucky or so blessed."
The ceremony ended with a carnival-like dance party in the middle of the stadium, though most of athletes and spectators had left by that point. The night's most surreal moment, however, came courtesy of the Tokyo 2020 organizing committee, when it had Japanese Prime Minister Shinzo Abe pop out of a green pipe dressed as Super Mario, as part of the handover ceremony.
And while these Games will be remembered around the world as a colorful, chaotic party, it's unclear what its lasting imprint on Rio will be.
Brazil spent about $12 billion in public and private money to host these historic Games, including $7.5 billion the government has spent on so-called legacy projects such as an overhauled transportation system. While most Cariocas will benefit from the improvements to mass transit, the Olympics' overall impact remains unclear.
The Brazilian government contends all residents will be able to enjoy the new Olympic venues, though many of the facilities were built in Rio's tonier neighborhoods. For example, the golf course, which will become public after the competition with the hope of promoting the sport here, is in Barra da Tijuca, a beachfront neighborhood that's home to some of the city's wealthiest citizens.
Madureira Park in the city's north zone and the slalom whitewater course in the disadvantaged Deodoro neighborhood could prove the exceptions. Residents began swimming in the slalom venue in November, prompting organizers to make plans for a public pool there once the Games are over. It will become part of an X-Park, which will also include BMX and mountain bike tracks, a skating rink and barbecue areas.
Experts, however, doubt the impact will go beyond Deodoro, pointing to the failure of the 2007 Pan American Games to increase recreation opportunities for average Rio resident. The city built four major venues for the 2007 Pan American Games, but none are currently being used by the broader population.
Though studies show host cities rarely reap long-term benefits for their hosting efforts, Bach predicted Rio would be different.
"These Olympic Games are leaving a unique legacy for generations to come," Bach said. "History will talk about a Rio de Janeiro before and a much better Rio de Janeiro after the Olympic Games."