Kenya's phenomenal Eliud Kipchoge stormed to a runaway marathon win and the USA basketball stars celebrated gold as a police raid clouded the final day of the Rio Olympics on Sunday.
As a Mongolian weightlifter was kicked out for drugs and police swooped on Irish officials over an alleged ticket scam just hours before the closing ceremony.
Kipchoge, 31, shone with his seventh win in eight marathons however.
He timed 2hr 8min 44sec on a rainy but picturesque course that snaked below Rio's mountain-top Christ the Redeemer statue, winning by more than a minute.
"This is the best medal that I've had in my life. It wasn't really easy but I felt comfortable," said Kipchoge, who is tipped for an assault on Dennis Kimetto's world record.
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.
But the Games also took place under the shadow of the Russian doping scandal, and were 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.
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.
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.
"To win more medals than we did in London and to be ahead of China is a spectacular place to be," UK Sport chief executive Liz Nicholl said.
"We are one of those sporting superpowers now," Nicholl beamed.
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.
Athletes and officials from around the world will attend Sunday's gala closing ceremony at the Maracana stadium from 2300 GMT, where Rio will pass the Olympic torch to Tokyo for the 2020 Games.
Prime Minister Shinzo Abe, meeting Japanese athletes in Rio ahead of the closing ceremony, 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 Japanese athletes.