The Rio Olympics officially came to a close Sunday night as the Olympic flag was passed to Tokyo, host of the 2020 Games, and the Olympic flame was extinguished.
Rio threw the customary party, the closing ceremony, with typical Brazilian panache. It began with fireworks and a bright dance to samba music at Rio's iconic Maracana stadium and ended with a Carnival parade.
The ceremony capped an Olympics that seemed in the run-up like it might never begin, threatened by Zika, political turmoil and budgetary shortfalls. But the opening ceremony came and the world turned its attention to 17 days of sports that largely went off without incident.
By the end, two of the greatest Olympians thrilled crowds before announcing their retirements (though fans are holding out hope Michael Phelps and Usain Bolt return in four years). And just 24 hours before hosting the closing ceremony, the Maracana was the site of Brazil's greatest Olympic victory ever: a gold medal in men's soccer, the nation's sporting religion.
The closing party celebrated the games and Rio itself, as brightly colored dancers formed the shape of the Christ the Redeemer statue and athletes paraded through a gauntlet of flags. Gymnast Simone Biles carried the American flag — gamely posing for a seemingly endless string of selfies — and Isaquias Queiroz, a multiple medal-winning canoeist, carried the Brazilian flag.
The governor of Tokyo formally accepted the Olympic flag, with the Olympic anthem reverberating through the stadium. Then came the biggest surprise of the ceremony: Japan's Prime Minister appearing in the center of the stadium in an entrance right out of a video game.
U.S. & World
[Rio2016] Best of Rio: Top Images from the 2016 Olympic Games
Shinzo Abe popped out of a green pipe dressed as Nintendo's Super Mario, to the delight of the crowd. The character travels through pipes in the games, and a video explained that Abe needed to transform into Mario and travel through the center of the Earth to get to the Maracana on time. Abe introduced a video previewing the 2020 Games.
One of the opening ceremony's biggest stars returned as well.
[NATL]Most Painful Moments of 2016 Rio Olympics
Tonga's flag bearer, Pita Taufatofua, didn't triumph in taekwondo, but his shirtless entrance into the Maracana two weeks ago won him instant acclaim. He hinted Saturday that he might have something special planned for the closing celebrations, warning, "Don't blink or you'll miss it."
Taufatofua was shirtless once again on his return to the Maracana Sunday. He jumped on stage with a group of performers for a quick dance in his grass skirt.
[Rio2016] Best of Rio: Top Images from the 2016 Olympic Games
Rosa Magalhães, one of Brazil’s most famous Carnival parade designers, produced the ceremony, which also saw the last medals of the games presented to the winners of the men's marathon: Kenya's Eliud Kipchoge, Feyisa Lilesa of Ethiopia and American Galen Rupp.
"These were marvelous Olympic Games in the 'marvelous city,'" said International Olympic Committee President Thomas Bach, playing off the "cidade maravilhosa" nickname of Brazil's postcard city of inviting coastlines, year-round sun and lush tropical vegetation.
While the stadium erupted in applause at that designation, a few minutes later there were boos of sadness when he announced: "I declare the Games of the XXXI Olympiad closed."
Rain fell intermittently during part of the ceremony, and some athletes threw ponchos on during their parade.
[NATL] Trailblazers, Record-Setters and More: Top Moments from the 2016 Rio Olympics
The rain let up by the end, but a simulation of Rio rain put out the Olympic cauldron's flames.
And then the party really got started. Dancers in massive feathered outfits grooved with athletes in a confetti-speckled tribute to Rio's famous annual Carnival and samba marches.
Carnival returns to Rio in February, one year before the Winter Games in PyeongChang, South Korea.