Rio Olympics 2016: The most memorable moments
The Rio 2016 Olympics have provided an abundance of memorable moments. Here are some of the best - good, bad, and ugly.
One of the first Olympic moments to go viral happened when Pita Taufatofua, Tonga's flag-bearer, appeared at the opening ceremony. The taekwondo athlete emerged topless, wearing traditional Tongan dress and apparently covered in baby oil. It did not go unnoticed.
One photograph quickly demonstrated that the Olympic games caters for all shapes and sizes. This photo of US gymnast Ragan Smith and basketball player DeAndre Jordan swept across the internet as soon as she posted it online.
Another Olympic highlight captured on social media. Lee Eun-ju of South Korea and Hong Un-jong of North Korea provided a moment of unity as the two gymnasts - from countries technically still at war with each other - posed for a smiling selfie.
It wasn't always so friendly in the swimming pool. Twitter went into meltdown after swimming legend Michael Phelps was pictured giving rival Chad le Clos a "death stare". He was caught putting his game face on while in the warm-up area of the Olympic pool, prompting #Phelpsface to trend on Twitter.
The first golden moment for the host nation - the story of Brazil's 57kg judo champion Rafaela Silva shone a light on some of Rio's poorest residents. From one of Rio's toughest neighbourhoods, the so-called City of God, Silva was disqualified at London 2012 and later labelled an embarrassment. Her victory marked a fairytale rise.
It wasn't long before Phelps, the most decorated Olympian of all time, broke into a smile, beating le Clos of South Africa in the men's 200m butterfly final. Some suggested le Clos should have been looking where he was swimming rather than watching his rival.
It was not all about the winners in the pool. Rami Anis - a swimmer for the refugee team who fled war-torn Syria in 2015 before travelling by boat across the Mediterranean Sea to Turkey - earned a standing ovation after setting a personal best in the men's 100m freestyle.
It wasn't just the swimmers attracting all the attention. Some bored-looking lifeguards - who had been charged with watching over the best swimmers in the world - caught the attention of many people on social media.
A memorable moment for a small nation. Fiji's rugby sevens players burst into song as they celebrated winning their country's first-ever Olympic medal - a gold - after beating Great Britain 43-7 in the final.
Nineteen-year-old US gymnast Simone Biles took the Games by storm, producing a stunning performance to win the women's all-around Olympic gold medal. She ended up taking home four gold medals and a bronze. She was even watched by Buzz Aldrin, a man who has walked on the moon.
The colour of the water at the Maria Lenk Aquatics Centre became a major talking point, after it turned from aquatic blue to a murky green overnight. Games organisers blamed chemical levels in the water.
Pictures of Egypt's women's beach volleyball team swept the internet, after Doaa Elghobashy took part while wearing a hijab.
American swimmer Katie Ledecky dominated in the pool, taking nearly two seconds off her own world record to win the women's 800m freestyle final in eight minutes 4.79 seconds - finishing nearly 12 seconds clear of the rest of the field. She also won the women's 200m freestyle, the 400m freestyle and the 4x200m freestyle relay.
The first world record inside the Olympic Stadium went to Ethiopia's Almaz Ayana, who smashed the previous record by more than 14 seconds to win gold in the women's 10,000m.
Egyptian Islam El Shehaby caused controversy when he refused to shake the hand of Israeli opponent Os Sasson after losing in the men's judo. El Shehaby was roundly booed by the crowd and was later sent home from Rio, the International Olympic Committee said.
Singapore's gold medallist Joseph Schooling, who idolised Michael Phelps as a child, managed to get the better of his hero in pool, winning the 100m butterfly ahead of Phelps, Chad Le Clos and Laszlo Cseh - who finished joint second. A photograph of a young Schooling, then just 13, with Phelps at the Beijing Olympics in 2008 quickly went viral.
One of the images from the track cycling came when Laurine van Riessen, of the Netherlands, managed to avoid a nasty crash with France's Virginie Cueff by riding up and along the barrier at the side of the track. Such was the extent of her precautionary action, she became almost horizontal.
Some athletes were disappointed to miss out on gold, or with having to settle with a mere silver or bronze medal. Not Aurimas Didzbalis of Lithuania. The weightlifter celebrated pocketing a medal in the men's 94kg with an impressive back flip.
A nation gasped when he tripped and fell, but despite taking a mid-race tumble, Britain's Mo Farah became the first British track and field athlete to win three Olympic gold medals as he retained his 10,000m title with a thrilling victory.
It wasn't all tears on the podiums. Britain's Sir Bradley Wiggins instead poked out his tongue to celebrate winning the men's cycling team pursuit - his fifth Olympic gold medal. He also became the first Briton to win eight Olympic medals.
Chinese diver He Zi had just collected her silver medal in the 3m women's springboard final when fellow diver Qin Kai entered the podium presentation. He duly got down on one knee, produced an engagement ring and proposed. She said yes.
Never far from the spotlight, Jamaica sprinter Usain Bolt managed to find time to smile for the cameras while easing to a 100m semi-final victory. It prompted a flurry of internet memes. He later won the final in a time of 9.81 seconds - his third 100m crown in three Olympic Games.
How do you upstage Mr Bolt? Why not break a world record less than half an hour before the great man was due to run in the 100m final? South Africa's Wayde van Niekerk shattered Olympic legend Michael Johnson's 17-year-old 400m world record by 0.15 seconds to sensationally win Olympic gold. Apparently the credit goes to his 74-year-old great-grandmother - who happens to be his trainer.
How can you forget a dancing weightlifter? Big David Katoatau, from Kiribati, threw some shapes every time he successfully made a lift. He finished sixth in the men's 105kg Group B final but certainly kept the crowds entertained.
Shaunae Miller of the Bahamas somehow managed to win a dramatic gold medal in the women's 400m final - by diving over the line. Miller stumbled in the final stages and then lunged forward as she headed towards the track, edging out American world champion Allyson Felix to win in 49.44 seconds.
Ireland's bantamweight Michael Conlan went out of the boxing tournament in the quarter-finals - losing on points to Vladimir Nikitin of Russia. Conlan was furious at the verdict, which was booed by the crowd, and he vented his frustration at the judges afterwards, saying he had been "robbed" of his dream of winning Olympic gold.
A golden night for Britain's golden couple. Laura Trott first won gold in the women's omnium - following up her victory in the women's team pursuit. She then had to sit trackside as fiance Jason Kenny won his third gold of the games and his sixth in total in a dramatic keirin - which twice had to be restarted. One relationship, 10 Olympic gold medals. Not bad.
There were tears on the podium for France's Renaud Lavillenie, but for all the wrong reasons. The pole vault silver medallist was booed by the Rio crowd for a second time in 24 hours, having lost out to home favourite Thiago Braz da Silva in a dramatic final.
One of the most bizarre stories from Rio involved American gold medal-winning swimmers and a petrol station. Ryan Lochte, Jimmy Feigen and Jack Conger became embroiled in an international scandal over a made-up robbery. It became an Olympic mystery and resulted in a police investigation and a series of apologies.
Was it fratricide? Was it brotherly love? It definitely ended well for the Brownlee brothers, Alistair and Jonny, who won gold and silver in the men's triathlon. The image of the British brothers collapsing into each other arms at the finish line will live long in Yorkshire memories.
Unperturbed Bolt, once again, shows his gregarious personality by pointing in admiration at Canada's Andre De Grasse as both men cross the line - in first and second place respectively - in the men's 200m semi-final. Bolt went on to win the final, of course.
Morolake Akinosun ploughed a lonely furrow down the home straight after the USA women's 4x100m relay team was allowed to re-run their heat after dropping the baton. They successfully argued they had been obstructed in their first race and ran on an empty track to qualify for the final. All the extra effort was worth it as the USA went on to win the final in 41.01 seconds - the second-fastest time in history.
Nick Skelton became Britain's second-oldest Olympic gold medallist when he won the individual show jumping event. The 58-year-old, who had retired in 2000 after breaking his neck in two places, triumphed after a six-way jump-off. The only person older than Skelton to win gold for Britain was shooter Joshua Milner in 1908 - aged 61. Skelton will not beat that record as he has ruled out competing in the Tokyo Games in four years' time.
The true Olympic spirit shone out when New Zealand's Nikki Hamblin (left) and Abbey D"Agostino of the USA helped each other out after colliding in their heat of the women's 5000m. D'Agostino tore her anterior cruciate knee ligament in the incident but both runners insisted on completing their race. They were both handed places in the final but the injury prevented the American taking part.
The triple triple? The treble treble? However you dress it up, Usain Bolt has nine Olympic medals from three Olympic Games. He said victory in the 100m, the 200m and the 4x100m relay would make him "immortal". It is hard to argue.
Brazil exorcised the demons of their 7-1 defeat by Germany in the World Cup semi-final in Belo Horizonte in 2014 by beating them in a penalty shoot-out to win the Olympic gold medal. The match had finished 1-1 after extra-time and star striker Neymar, who missed the World Cup humiliation because of injury, scored during normal time before converting the decisive penalty and bursting into floods of tears.
Britain's Mo Farah completed the double double as he became only the second man, after Finland's Lasse Viren, to retain both the 5,000m and 10,000m Olympic titles. His four gold medals make him his country's most successful track and field athlete.
After the competition, came the party as Rio produced a carnival-style closing ceremony full of music, dancing and colour.
The Olympic flame was extinguished with artificial rain - on a night where there had been plenty of actual rain.
Japanese Prime Minister Shinzo Abe appeared dressed as computer game character Super Mario, with the next Olympics being held in Tokyo in 2020.