Beijing faces a choice in Hong Kong between repression and climbdown.
The demonstrations on the streets of Hong Kong present China with its biggest political challenge since the pro-democracy movement was crushed in and around Tiananmen Square in 1989.
The parallels between the demonstrations in Hong Kong now and those in Beijing 25 years ago are eerie - and must be profoundly unsettling to the Communist Party leadership. Once again, the protests are led by students demanding democratic reform. Once again, the central authorities have lost control - and risk facing a choice between repression and a humiliating climbdown. And once again, the ultimate question is the power and authority of Beijing.
However, the differences between Hong Kong this year and Beijing in 1989 are also significant. In the intervening 25 years, China has become an immeasurably richer and more powerful country. The Chinese authorities will also be hoping the demonstrations in Hong Kong, which started under the banner of the Occupy Central movement, will have more in common with Occupy Wall Street - which fizzled out - than with the student movement in China in 1989. Finally, the authorities have more leeway than in 1989, if they choose to use it, because Hong Kong is not the capital of the country - it is a regional city which enjoys special status under the "one country, two systems" formula that underpinned the handover from British to Chinese rule.
Under that formula, Hong Kong continues to enjoy a free press and an independent judiciary - freedoms that do not exist on the mainland. The question now is whether Hong Kong will be allowed to take the next step towards democracy and to choose its own chief executive, without having the candidates pre-screened by Beijing.
An intelligent response from the Communist Party would allow Hong Kong to act as a test bed for democratic reforms. The formula of "one country, two systems" - allied with the territory's wealth and sophistication - is perfectly designed to allow Hong Kong to proceed with democratic reforms without triggering immediate demands for similar changes on the mainland. A successful and democratic Hong Kong might then serve as a model for the gradual introduction of similar reforms at a local and city level in the rest of China.
Unfortunately, the central government in Beijing seems determined to take the opposite path. It cannot risk allowing democracy to flourish within China's borders. It cannot allow the express wishes of the party to be flouted. By taking this decision, China has set itself on the path of confrontation with the demonstrators. If they do not drift away, the risk of violent intervention by China obviously rises.
It did not - and does not - have to be this way. For some years after the handover in 1997, it looked as if China was handling Hong Kong with impressive tact and sophistication. The press stayed free; the courts stayed independent. Beijing even allows a moving commemoration of Tiananmen to take place every June 4. Four years ago, the veteran pro-democracy campaigner Martin Lee told me he had been "pleasantly surprised" by the extent to which China had allowed Hong Kong to preserve its freedoms. But earlier this year, when I met Mr Lee again, his views had changed completely. Now he warned that Beijing seemed intent on denying Hong Kong democracy and eroding the independence of the courts.
What has changed? Perhaps the Communist Party in Beijing has become more assertive and less tolerant. Perhaps it was never willing to risk real democracy emerging in Hong Kong.
Over the next few days, the world's eyes will be on the streets of Hong Kong. But the public's reaction in mainland China will also be crucial. The development that Beijing must fear most is the spread of pro-democracy demonstrations to the mainland.
Beijing is trying to block news from Hong Kong on the official Chinese media and on the Internet. If the protests continue, Beijing may also try to exploit a latent antagonism between mainlanders and Hong Kong citizens. In Hong Kong, mainlanders are sometimes portrayed as uncouth interlopers. In China, Hong Kongers are sometimes portrayed as spoiled brats with an unpatriotic nostalgia for colonial rule.
The idea that Hong Kong citizens are less than truly Chinese is something the nationalist press in China may exploit if the protests escalate. In that, the official reaction to Hong Kong could be reminiscent of Russia's reaction to demonstrations in Ukraine. The Ukrainians and Hong Kongers are embraced as brothers, in Moscow and Beijing, as long as they stay in line. But if they err, they can quickly be denounced as tools of Western imperialism.
The difference, of course, is that Hong Kong is part of China's sovereign territory whereas Ukraine is now an independent country. However, a violent denouement to the demonstrations in Hong Kong will disrupt relations between China and the West, almost as surely as the annexation of Crimea destroyed business as usual between Russia and the West. The government in Beijing is pondering its next move. In the interests of Hong Kong, China, the global economy and international political stability, it is crucial it gets it right.