South America's first Olympic Games was declared over in pouring rain here tonight, but also in a blaze of colour, vibrancy and samba-dancing as Brazil came together to celebrate an event which had been a "great challenge, but a great success", according to its chief organiser.
If ever a Closing Ceremony was a snapshot for an entire Games, then it was tonight.
It was clear that the finale of Rio 2016 was put together on a much lower than budget than at Beijing 2008 and London 2012.
They also faced the extra challenge of heavy rain and wind as well as an electricity outage shortly before action began.
The empty seats around the Maracanã also reminded people why these Olympics will never be remembered among the great Games.
Once again, though, they managed to survive as generators were put into operation and a three-week festival of sport was closed in celebratory fashion.
Samba music blasted around the arena after the Olympics Flame had been extinguised as athletes - many of them enveloped in waterproof coverings - mingled together as they danced and jigged.
"We celebrate the Olympic Flame together with all of you," said Rio 2016 President Carlos Nuzman.
"Rio did history, he shows his beauty and confidence to organise the most important sporting event in the world.
"It is a better city and is still a magic place.
"The Games in Rio was a great challenge, but a great success.
"I will say this again, I am proud of Rio, I am proud of my city.
"Yes, we are different, from North to South, but all Brazilians are Olympic heroes, vibrant together.
"These Games show that Brazilians do not flee from a battle."
The crowd booed when Rio de Janeiro Mayor Eduardo Paes entered and passed the flag to Tokyo Governor Yuriko Koike.
There were loud cheers, though, when Nuzman and International Olympic Committee (IOC) President Thomas Bach spoke and moans almost of protest when the Games were declared over.
Tonight's event was presented partly as a celebration of Olympism, with tributes paid to the new Olympic Channel and new members of the IOC Athletes' Commission, including the Russian pole vaulter Yelena Isinbayeva, unable to compete at here because of the ban on her country's athletes after allegations of state-supported doping.
As is traditional, Bach and International Association of Athletics Federations counterpart Sebastian Coe crowned Kenya's Eliud Kipchoge as gold medal winner in the men's marathon.
Brazilian music and dancing left many of the more memorable moments, however, as athletes paraded out into the infield as the rain poured down.
Perhaps the single highlight came during the Tokyo 2020 segment looking ahead to the next Olympics, when Japanese Prime Minister Shinzō Abe emerged from a green pipe disguised as Super Mario.
An amination showed a drill cutting through the Earth all the way from Japan to Brazil before Abe - a key lobbyist when Tokyo successfully bid for the Olympics and Paralympics three years ago - emerging holding a bright red ball in his hands.
Rio could have done with a superhero at times during the last three weeks and it left a feeling of confidence about what the organisation, support and atmosphere will be like in the Japanese capital in four years time.
Bach focused only on the positive side of Rio 2016 tonight as he praised an Olympics which may not have been the greatest ever, but were described as "marvelous".
"We arrived in Brazil as guests, today we depart as your friends," he told the crowd.
"You will have a place in our hearts forever.
"These were marvellous Olympic Games in the marvellous city.
"These Olympic Games are leaving a unique legacy for generations to come.
"History will talk about a Rio de Janeiro before and a much better Rio de Janeiro after the Olympic Games."
Bach then presented the Olympic Cup - an award conceived by modern Olympic founder Pierre de Coubertin - onon stage to six local "cariocas".
Unlike his predecessor Jacques Rogge at London 2012, he did not look ahead to the Paralympics in his speech, but Rio will now enjoy a 17-day break before action resumes on September 7.