The Bird's Nest stadium hosted a glorious closing ceremony
The Olympic Games have drawn to a close with a glittering ceremony inside Beijing's Bird's Nest Stadium.
Spectacular fireworks kicked off the proceedings, while a beautifully choreographed drumming and dancing display recalled the opening ceremony.
It was a more celebratory affair, as exuberant athletes, dancers and musicians got into the party spirit.
The Olympic flag was handed to London mayor Boris Johnson, with organisers briefly showcasing the 2012 Games.
The countdown to 2012 has started, and organisers will know they have a great deal to live up to with China hosting one of the best organised Games in history and staging some of the most memorable opening and closing ceremonies ever seen.
Beijing's dramatic farewell to the 29th Games of the modern Olympiad got under way with a magnificent firework display, which quickly segued into an amazing display of dancing and drumming.
Scottish cyclist Chris Hoy, who claimed three gold medals in Beijing, carried the flag for Team GB as more than 200 flag bearers led the way for the thousands of athletes.
After speeches from Liu Qi, president of the Beijing Organising Committee, and International Olympic Committee president Jacques Rogge, the Beijing Games were officially declared to be over.
China staged the Olympics against a background dominated by fears of pollution, worries over security and protests about its human rights record.
But the sporting action was enthralling, with highlights including Michael Phelps swimming to a record eight gold medals and Jamaica's Usain Bolt breaking three world records on his way to three golds.
"We have come to the end of 16 days which we will cherish forever," said Rogge.
"New stars were born and stars from previous Games continued to amaze us.
"We shared their joys and their tears and marvelled at their abilities, and will long remember their achievements here.
"These were a truly exceptional Games."
London mayor Boris Johnson accepted the flag ahead of 2012
The British flag was raised and "God Save the Queen" sung by the choir, before Johnson was handed the Olympic flag from Guo Jinlong, the major of Beijing, and Rogge.
It heralded the start of an eight-minute segment for London organisers to offer a flavour of the 2012 Games, as a red London bus arrived into the stadium.
Hoy, dressed up as a city gent, and fellow British cyclists Victoria Pendleton and Jamie Staff accompanied the bus on bicycles alongside a troupe of dancers holding umbrellas.
Singer Leona Lewis and former Led Zeppelin guitarist Jimmy Page emerged as the bus transformed into a grass-covered carnival float, and the pair combined for a rendition of "Whole Lotta Love".
And the biggest star turn came when former Manchester United star and England captain David Beckham arrived to kick a football into the crowd of athletes.
The Olympic flame was then extinguished, before the attention shifted to a "memory tower" in the centre of the stadium.
Legendary Spanish tenor Placido Domingo and Chinese soprano Song Zuying joined forces to sing, while Hollywood actor Jackie Chan later joined a throng of dancers and singers for a closing number.
The sporting action was finally brought to an end earlier in the day, with France's men claiming gold in the final of the handball.
It was the 302nd and last gold medal to be awarded, and followed Sunday's finals in boxing, basketball, volleyball and water polo, while Kenya's Sammy Wanjiru won the men's marathon.