London said farewell to the Olympic Games on Sunday with a high-octane romp through British pop music, bringing the curtain down on more than two weeks of action at the end of which the United States topped the sporting world with 46 gold medals.
There was another sellout crowd at the 80,000-capacity athletics stadium in East London for the final act of the Games, and another 300 million people were expected to tune in on television sets around the world.
The concert opened with a countdown followed by the chimes of Big Ben marking 9 pm (2000 GMT). The set included the London landmark, as well as replicas of the London Eye, Tower Bridge and St. Paul's Cathedral.
Actor Timothy Spall read from Shakespeare's "The Tempest" dressed as war-time Prime Minister Winston Churchill, and after a London "rush hour" featuring real cars and trucks wrapped in newspaper, Prince Harry entered to represent his grandmother Queen Elizabeth.
Later in the concert, athletes enter and the winner of the men's marathon is awarded his medal.
The ceremony then switches to an hour-long celebration of British pop of the last five decades featuring hits such as "Imagine", "Bohemian Rhapsody" and "Pinball Wizard".
The Spice Girls, George Michael and The Who are among the cast set to perform, and, after a section devoted to the 2016 Olympic hosts Rio de Janeiro there will be closing speeches and the Olympic Flame is extinguished.
LIGHTNING STRUCK THRICE
The stadium has seen some of the most spectacular moments of the Games, including Jamaican sprint king Usain Bolt defending the 100, 200 and 4x100 metres titles he won in such spectacular fashion in Beijing, the latter in a world-beating time.
British supporters will also cherish memories of the venue, where Somali-born runner Mo Farah won the 5,000 and 10,000 double to deafening roars and was celebrated as a symbol of the capital's multi-culturalism.
The host nation won 29 golds to take third place in the rankings, its best result for 104 years which helped lift the nation out of the gloom of an economic recession temporarily buried in the inside pages of the newspapers.
"I will say history has been written by many athletes. The Games were absolutely fabulous. London has absolutely refreshed the Games," International Olympic Committee President Jacques Rogge told reporters.
British Prime Minister David Cameron agreed, writing in a succinct message on Twitter: "Britain delivered. We showed the world what we're made of."
Many will remember London 2012 for the record-breaking exploits of American swimmer Michael Phelps, who took his life-time medal haul to 22 including 18 golds, making him the most decorated Olympian in history.
His tally helped the United States to the top of the Olympic table with 46 golds to second-placed China's 38, reversing the order of the Beijing Games in 2008.
There was, of course, Bolt, the biggest name in athletics and a charismatic ambassador for sprinting.
After winning the 4x100 he went on to a London nightclub to delight dancing fans with a turn as a DJ, shouting out "I am a legend" to the packed dancefloor.
Britons may recall Andy Murray demolishing world number one Roger Federer at Wimbledon to win the men's singles tennis gold, while Jessica Ennis, the "poster girl" of the Games, won the women's heptathlon on the first "super Saturday".
Despite concerns about the creaky transport system and a shortfall of private security guards, which forced the government to call in thousands of extra troops to help screen visitors, the Games have so far passed by fairly trouble-free.
A furore over empty seats at several Olympic venues blew over, especially once the track and field showcase kicked in and drew capacity crowds for virtually every session.
Even the weather improved as the Games wore on. Bright sunshine has graced the closing weekend of a festival that has helped to lift spirits in Britain.
On the last day of sporting action, the US basketball team including the likes of LeBron James, Kevin Durant and Kobe Bryant downed Spain in a repeat of the final in Beijing in 2008.
The score of 107-100 reflected a closely fought contest played at breakneck speed in which Durant led the scoring with 30 points.
Earlier on Sunday, Stephen Kiprotich of Uganda broke away from two Kenyan rivals to win the men's marathon near Buckingham Palace before vast crowds, reflecting local enthusiasm for the Games despite doubts about the cost and potential disruption.
After running side by side with world champion Abel Kirui and Wilson Kipsang, the 23-year-old put in a powerful kick to shake off the Kenyans 6 km from the end.
The women's modern pentathlon was the final medal to be decided, and Lithuanian Laura Asadauskaite beat Briton Sam Murray to the gold to round off London's extravaganza of sport.
Some, though, left London with less happy memories.
China bowed out of the Games with a swipe at the critics who had accused teenage swimming sensation Ye Shiwen of doping after her times rivalled the top US men.
Aged just 16, Ye set a world record, a Games record and won two gold medals in the women's individual medleys, but her victories were overshadowed by questions and insinuations of cheating. There was no evidence that she had broken any rules.
The head of the Chinese delegation to London, Liu Peng, said the accusations were totally unfounded and stressed that China was strongly opposed to any doping "misbehaviour".
"This is really unfair. This is groundless," Liu told a news conference on Sunday. "There are individuals and media that are accusing, unfounded, our Chinese athletes. These people should respect sporting persons' dignity and their reputation.