he Rio Olympics closing ceremony got underway on Sunday after Eliud Kipchoge s dominant marathon victory highlighted the final day of competition.
Athletes and officials from around the world were attending the event at Rio s Maracana stadium which will bring down the curtain on South America s first Olympics.
On a wet and blustery final day, Kenya s Kipchoge, 31, shone with his seventh win in eight marathons, timing 2hr 8min 44sec to win by more than a minute.
Later, the USA s basketball Dream Team of NBA stars claimed the 306th and final gold of the Games with a crushing 96-66 win over Serbia.
Kipchoge topped off an athletics programme which saw Usain Bolt seal the sprint triple triple in his final Games, but also went ahead without Russia who were suspended for state-orchestrated doping.
Michael Phelps capped his Olympic career in Rio, adding five gold medals to take his career haul to 23 — plus a silver, after his loss to Singapore s Joseph Schooling, a former childhood fan of the US swimmer.
The Games, set against the backdrop of Brazil s political and economic crisis, were also hit by security and logistical problems and the unwanted spectacle of swathes of empty seats.
On Sunday, Mongolia s Chagnaadorj Usukhbayar became the sixth weightlifter in Rio to fail a drugs test. He was kicked out after he was revealed to have used testosterone.
And police seized passports, phones and computers in a raid on the Irish Olympic office, following the arrest of Irish International Olympic Committee member Patrick Hickey over an alleged black market tickets scam.
With the basketball win, America matched its tally of 46 golds from London four years ago to lead the medals table from Britain, who sealed surprise second place ahead of China with 27 golds to 26.
“We are one of those sporting superpowers now,” beamed UK Sport chief executive Liz Nicholl.
Also on the final day, Brazil finished with a flourish as they beat Italy 3-0 to win the men s title in volleyball, one of the country s most popular sports, a day after Neymar guided the hosts to football gold.
French fighter Tony Yoka won a split-decision against Britain s Joe Joyce to take the super-heavyweight title in boxing, where Uzbek fighters stole the show with two gold medals.
Switzerland s world champion Nino Schurter, third in Beijing and second in London, competed his ascent of the podium by winning the men s mountain bike competition.
Denmark upset two-time defending champions France 28-26 to win the men s handball title.
And there were furious scenes when a Mongolian coach stripped down to his underwear to protest a decision against wrestler Ganzorig Mandakhnaran.
At the colourful closing ceremony, which opened with schoolchildren singing Brazil s national anthem, Rio will pass the Olympic flame to Tokyo for the 2020 Games.
Prime Minister Shinzo Abe, meeting Japanese athletes in Rio on Sunday, said Tokyo now wanted to put on the best Olympics yet.
“The Japanese government will strive hard so you can participate in the Tokyo 2020 Olympics so you will be in your best condition, and work hard so it will be the best Olympics ever,” Abe told the Japanese athletes.