Occupy Central leaders before entering a court in Hong Kong on Monday. Nine leaders of the 2014 Hong Kong pro-democracy movement stood trial Monday. (Vincent Yu/AP)

HOW LONG is 50 years? Apparently, in China it is 21 years.

When Hong Kong was handed over to China in 1997, a joint declaration between Britain and the People’s Republic stipulated that freedoms in Hong Kong would be preserved for half a century. The agreement declared, “Rights and freedoms, including those of the person, of speech, of the press, of assembly, of association, of travel, of movement, of correspondence, of strike, of choice of occupation, of academic research and of religious belief will be ensured by law.” Twenty-one years later, China is trashing the promise it made to keep Hong Kong free.

Consider the expulsion of Victor Mallet, the Asia news editor of the Financial Times, and China’s recent refusal to admit him as a visitor . In August, Mr. Mallet had hosted a talk at the Foreign Correspondents’ Club, where he was acting president, by Andy Chan, founder of the Hong Kong National Party, a tiny political group that advocates independence from China. The independence party was subsequently banned in China in September, and in October, Mr. Mallet’s visa was not renewed.

China’s authoritarian rulers, led by President Xi Jinping, react with horror at any sign of independence movements. They bristle at any show of autonomy by Taiwan and vigorously attempt to smother restiveness in the ethnic regions of Tibet and Xinjiang. In fact, the notion of independence hardly enjoys widespread support in Hong Kong, long a citadel of openness and thriving capitalism. One poll last year showed that only 11.4 percent of those asked supported independence. But the idea picked up more attention when the student-led street protests of 2014, known as the Umbrella Movement, failed to gain ground, and some young activists began to talk about Hong Kong independence as the only pathway to democracy.

Chinese authorities attempted to stop Mr. Chan from speaking by asking Mr. Mallet to cancel the event, then punished Mr. Mallet for going ahead. On the mainland, China routinely behaves this way, choking off free expression and surrounding hundreds of millions of people with a digital cordon so they can’t see the outside world. But the deal for Hong Kong was to be “one country, two systems,” meaning China was supposed to leave the former British colony to its own, more tolerant ways.

In reality, Beijing has airily abandoned the pledges made to Britain. Last year, a Chinese foreign ministry spokesman said the joint declaration “no longer has any practical significance.” China has prosecuted Hong Kong pro-democracy protesters — a new trial of some began Monday — and targeted booksellers who peddled controversial volumes. Independence is clearly a marginal idea in Hong Kong now, but the attempt to squelch it could make it more popular. As it often has, China’s repression in Hong Kong is hurting its own cause.