It was the smoothest of handovers. At 11.59pm on June 30, 1997, a little after guests at Hong Kong's Regent Hotel had enjoyed curry in the Raj room and rum punches in the Caribbean room, a military band struck up God Save the Queen. The Union flag - and the British Empire with which it had for so long been synonymous - fell in unison.
The last note had hardly faded when the band of the People's Liberation Army struck up a rather different anthem.
Just as they did so, at the stroke of midnight, the red and yellow-starred flag of Communist China began to be raised. After 156 years, Britain was surrendering its last major colony - but, for a time, it seemed only the pomp was changing.
Twenty years on, Hong Kong is preparing for another act of street theatre. On July 1, Xi Jinping is expected to make his first visit as China's President. He will commemorate the anniversary with a flag-raising ceremony to swear in the city's new chief executive, Carrie Lam. Under the slogan "Together, Progress, Opportunity", the Government has organised more than 500 celebratory events, including concerts, competitions and exhibitions.
Yet behind the hoopla, the transition from British to Chinese rule has been rather bumpier. Under the handover agreement, Beijing agreed to permit "one country, two systems" for 50 years. Hong Kong would become part of China, but it would be a "special administrative region", with its capitalist system and freedoms such as an independent press and judiciary respected. A growing number of Hong Kongers believe China is honouring its commitment only in name, and has welched on its promise to deliver democracy.
As many as a third of the city's police force are expected on the streets to protect Xi, but they will not be able to drown out the dissent. That same afternoon, Hong Kongers will attend a pro-democracy rally in Victoria Park. "There will be some pomp," said Cliff Buddle, an editor at the South China Morning Post. "And there will be some protests."
Two days later, on July 3, one of the city's youngest democrats, Joshua Wong, will direct renewed international attention to his cause when he appears in the High Court, charged with criminal contempt of court for violating an injunction in 2014, when, aged 17, he helped to lead the "umbrella movement" that occupied the city's Central business district for 79 days. His struggle for universal suffrage has just been made into a Netflix documentary, under the title Teenager v Superpower.
Wong, who was only nine months old at the time of the handover and is still a student, was briefly disillusioned when the protest ended without any concessions from Beijing. "I felt downhearted and depressed. We asked people to sacrifice their jobs, their family or their future careers, but we have not received any concrete results." Now he is ready to join the fray again. "After the umbrella movement, July 1 will be the largest rally. I hope 100,000 people will come to the streets to ask for democracy. It is not a time for celebration."
Only half of the members of the city's Legislative Council are elected by all Hong Kongers. Most power resides with the chief executive, a post which is not popularly elected. Unlike the city's older generation, who critics say are content to ignore constitutional matters so long as the city's economy continues to flourish, Wong and many fellow students are ready to confront Beijing.