Fireworks explode at the 'Heroes of the Games' segment during the event. Photograph:( Getty )
Security scares and logistical problems were a feature of South America's first Olympics, held against the backdrop of Brazil's political and economic crisis.
Swathes of empty seats caused disquiet but the Games also witnessed the last hurrahs of both Usain Bolt and Michael Phelps, who both lived up to their billing.
Bolt sealed the sprint 'triple triple' in his final Games, reaching a record-equalling nine gold medals with his third consecutive 100m, 200m and 4x100m sweep.
Swim legend Phelps took his unmatched career haul to 23 gold medals with another five in Rio plus a silver, after his loss to former childhood fan Joseph Schooling.
Brazil came late to the party but the country celebrated long and loud when Neymar won a gold-medal penalty shoot-out against Germany to erase memories of their 7-1 World Cup semi-final humiliation in 2014.(AFP)