Last week’s sudden outbreak of verbal hostilities with China, triggered by violent clashes in Hong Kong, provided a disturbing glimpse of post-Brexit Britain’s isolated and impotent future in a world of more muscular adversaries. It also underlined a dilemma facing all the western democracies in their dealings with Beijing: what matters most – liberal values or money-making?

Like bullies sensing weakness, Chinese officials let rip after Britain dared defend the demonstrators’ right to protest against the erosion of Hong Kong’s freedoms. The row released tensions largely suppressed since the former colony was handed back in 1997. The depth of China’s pent-up fury was cautionary.

Liu Xiaoming, China’s ambassador, led the charge, demanding Britain keep its “hands off Hong Kong”. Liu misrepresented the foreign secretary Jeremy Hunt’s public support for the protesters as implying support for violence. Another official was personally insulting, accusing Hunt of “basking in the faded glory of British colonialism”.

China’s claim that Britain was surreptitiously fomenting unrest as part of a wider destabilisation conspiracy was classic Communist party propaganda-cum-paranoia. At the same time, Britain was mocked as an enfeebled, failing country, unable to manage its own internal problems. The obvious contradiction did not inhibit the rhetoric.

These broadsides, intended to demonstrate proud resilience, spoke instead of abiding insecurity. Xi Jinping, China’s “strongman” leader and de facto president-for-life, is said to have been deeply influenced by the east European revolutions of 1989 and the subsequent implosion of the Soviet Union.

Xi fears one-party China could go the same way. “Why did the Soviet Communist party collapse?” Xi asked in 2013 when discussing the risks posed by popular insurrections. One reason, he said, was that “nobody was a real man”. That tough-guy Xi is determined not to repeat Mikhail Gorbachev’s supposed mistakes is already abundantly clear.

His time in power since 2012 has been marked by expanding state control, a Mao-style personality cult reinforced by purges of party rivals (dressed up as anti-corruption drives), mass detentions and human rights abuses, pervasive censorship and an aggressive foreign policy signalling China’s ambitions as a global superpower.

Hong Kong’s demand for democratic self-determination directly contradicts Xi’s vision of the unchallengeable power of the party and its “core leader”. It threatens his ascendancy. Worse, it could encourage copycat resistance in mainland China, where public discontent exacerbated by an economic slowdown is growing.

That means more Hong Kong arrests and jailings. It means a slow-motion stifling of dissent, whatever Britain may say. And despite Thursday’s limited offer of talks, it may yet mean direct rule from Beijing, short-circuiting the “one country, two systems” formula. “No one is in a position to dictate to the Chinese people,” Xi proclaimed last December. “The party is everything.”

The ruins of the Summer Palace at Yuanmingyuan park in Beijing. Photograph: Adrian Bradshaw/EPA

It’s not all China’s fault. Deep-rooted anger at Britain has its origins in events largely forgotten in London but not in Beijing. It is true, as China says, that postwar colonial Britain showed scant regard for Hong Kong residents’ rights. This indifference was consistent with earlier humiliations heaped on the ruling Qing dynasty by Victorian imperialists – the cause of China’s “lost century”, concluding in 1945.

The first Anglo-Chinese opium war, from 1839-42, was supposedly a response to Chinese insults to Britain’s national honour. In truth it was mostly about money and power, about imposing free trade, and about securing a lucrative market for opium exports from British India, regardless of the human cost.

This destabilising intervention opened the gates to other foreign invaders and to decades of revolts, such as the Taiping rebellion, when up to 100 million people may have died. It also foreshadowed an infamous act of cultural vandalism, the burning and looting by British and French forces of the emperor’s wondrous Summer Palace in Beijing in 1860. Its Chinese name was Yuanmingyuan – “garden of perfect brightness”. And it was utterly destroyed. All Chinese schoolchildren are taught this.

Hunt deplored Beijing’s trashing of the 1984 Sino-British joint declaration, calling it an affront to the international rules-based order from which China benefits. But such righteous outrage comes awkwardly from a country that waged war in Iraq without legal authority and stays on friendly terms with murderers in Saudi Arabia. It ignores the lawless history of the pre-1914 “unequal treaties”.

Ironically, these old injustices were instrumental in shaping the Chinese communists’ 20th-century anti-imperialist, nationalist ideology – and the party’s insistence on regaining sovereignty over “lost” territories such as Hong Kong, Macau and, prospectively, Taiwan. As was often the case during its empire-building days, Britain sowed the seeds of its ultimate displacement.

China’s disdain, bordering on contempt, for Britain’s warnings stems not only from London’s past hypocrisy and historical amnesia, but also from a keen assessment of its current, palpable weakness. Given the gaping power imbalance, Hunt’s threat of unspecified “severe consequences” is all but meaningless.

The reality is chastening. Britain will need a post-Brexit trade deal. It needs Chinese investment, technological expertise, and even Huawei (if the US allows). But China does not really need Britain. Acting alone from a position of relative dependency, Britain cannot by itself change China’s behaviour or effectively promote its own values. That requires the sort of leverage only strong alliances bring. And since Donald Trump cannot be trusted, that means a united European front.

But Europe is being recklessly shunted aside. Even as he claims Britain is still a country with “global reach”, Hunt (like Boris Johnson) is undermining British international leadership and influence.

China’s scorn is well deserved. Democracy in Hong Kong is set to become Brexit’s first big overseas casualty.