Rio said farewell to the 2016 Paralympics in a closing ceremony showcasing Brazil's passion for music and celebrating what many consider to have been a surprisingly successful Games.
The famous Maracana football stadium was packed, with the Paralympians themselves seated across the field, as proceedings kicked off with fireworks.
Among the first performers was Jonathan Bastos, a Brazilian who was born without arms but has became an accomplished musician, playing the guitar with his feet. Then it was Ricardinho, star of Brazil's gold medal winning five-a-side Paralympic football team, who brought out the national flag.
But the glittering celebration -- at one point featuring an unscripted conga line of dancing athletes -- paused for a minute's silence to remember the fatal crash of an Iranian cyclist on Saturday.
Bahman Golbarnezhad's death during the road race left the Paralympic movement "united in grief," Philip Craven, the International Paralympic Committee president, said in a speech.
Overall, organizers are breathing a sigh of relief that predictions of failure for South America's first Olympics and Paralympics were proved wrong.
"Mission accomplished," said Carlos Nuzman, president of the Rio organizing committee.
Referring to the political instability and deep recession plaguing Brazil, he conceded that it had been "a mission of many doubts."
As Craven declared the Games over -- with Tokyo now taking up the baton for 2020 -- he said Brazil had passed a difficult test.
"These Games importantly signal a very bright future for this youthful and wonderful nation," Craven said.
- Magic moment -
Eleven days of competition where China dominated the medals table, followed by Britain, ended earlier with the last few events, including marathons and wheelchair rugby.
Watching the marathon along the seafront in Copacabana earlier, spectator Marcelo Augusto Miranda Costa said the Games had been "a moment of magic for the city."
"We're going to miss them, yes," he said.
The generally positive ending was quite the turnaround from a few weeks ago when the Rio organizers' woeful finances in the wake of the August Olympics and a stunning lack of interest in tickets raised fears of failure.
By the end, officials said, they had sold 2.1 million tickets -- fewer than London in 2012 but more than Beijing four years earlier. Part of that success, however, was due to many tickets being sold for as little as $3 -- or given away to school children in an international fill-the-seats campaign.
Also haunting these Paralympics was Brazil's political crisis. President Michel Temer, who had just taken power after his rival Dilma Rousseff was thrown out of office in an impeachment vote, was loudly booed by the crowd at both at the Olympic and Paralympic opening ceremonies.
Although Temer did not attend the closing ceremony, one of the performers, Lucio Maia from the band Nacao Zumbi, took the opportunity to flash a "Get out Temer" sign to the television cameras.
And tensions over a ban imposed by the International Paralympic Committee on the entire Russian team because of alleged state doping remain strong.
Craven warned earlier Sunday that "major change" will be needed from Russia to be allowed back into Paralympic competition.
- China on top -
The gap between the Olympic and Paralympic performances is gradually blurring with disabled athletes breaking records after records in Rio.
Among the stars were Brazil's swimmer Daniel Dias who added four golds, three silvers and two bronzes to his existing medal haul from Beijing and London -- which has won him descriptions as the Michael Phelps of the Paralympics.
There was amazement in the 1,500m track race when Algeria's Abdellatif Baka set a new record that was actually faster than the winning time by Olympic gold medalist Matthew Centrowitz in the same stadium a month earlier. However, Centrowitz won in what was by Olympic standards a near-record slow race, meaning Baka's outstanding time was of mostly symbolic significance.
Once more, it was China that dominated overall, with 239 medals, including 107 golds -- far ahead of nearest rival Britain with 147 total and 64 golds. Ukraine with 117 medals and the United States with 115 followed.