Xi Jinping’s tough talk in Hong Kong reflects growing self-confidence in China’s ability to shape world events and browbeat or ignore less powerful countries such as Britain.

The Chinese president could have thrown a bone to the pro-democracy movement. He could have offered a sop on civil liberties and political rights to western opinion. Instead, he told Hong Kong who’s boss.

Xi the hard man laid down the law according to Beijing. His message: fall into line, or else.

His message to Britain was blunt, too, bordering on disdainful. China would not brook outside “interference” in the former colony. Forget about those guarantees of a free, open society painstakingly negotiated before the 1997 handover.

“Any attempt to endanger China’s sovereignty and challenge the power of the central government is absolutely impermissible,” Xi said.

Under Xi’s bastardised version of the Basic Law, any criticism is henceforth forbidden, on pain of serious consequences. Boris Johnson received a stinging lesson in the new balance of power earlier in the week.

“As we look to the future, Britain hopes that Hong Kong will make more progress toward a fully democratic and accountable system of government,” the foreign secretary intoned with uncharacteristic meekness.

Johnson’s statement was shamefully deferential. He could, and should, have been more forceful about Beijing’s responsibilities and its own egregious, sometimes illegal meddling. But China took umbrage all the same. Liu Xiaoming, China’s ambassador in London, set Johnson straight: Hong Kong issues must henceforth be “handled properly” or overall ties would suffer.

Worse was to follow. On Friday, China’s foreign ministry formally renounced the 1984 Sino-British joint declaration, the basis on which Britain agreed to relinquish control of the colony. The two sides had agreed the treaty would remain in force for 50 years.

“The Sino-British joint declaration, as a historical document, no longer has any practical significance, and it is not at all binding for the central government’s management over Hong Kong,” the spokesman Lu Kang declared. The Foreign Office swiftly rejected the demarche. But in his present bullish mood, Xi is not listening.

China’s hardening stance is deeply threatening to Hong Kong and bilateral relations. It suggests China’s official word cannot be trusted, whether the issue is Hong Kong’s (and Taiwan’s) continued freedoms, illegal regional military expansion, or investment in Britain’s nuclear industry, retailers and real estate.

China’s evident sense of impunity is humiliating for Britain, too. It dramatises Britain’s diminished standing in the world and an alarming shortage of reliable friends and allies. Will Donald Trump help? Will an alienated European Union? Unlikely.

Theresa May’s government faces a choice between upholding legal principle and democratic values, and its chronic post-Brexit need for Chinese trade and business at any price.

No prizes, or yellow umbrellas, for predicting which way May and Johnson will jump.