Up to a million demonstrators have taken to the streets of Hong Kong in recent days in protest over a proposed extradition law that would allow people to be sent to China for trial. The reform is yet another sign of Beijing’s ambition to erode civil liberties in Hong Kong and to integrate the supposedly autonomous territory more deeply into its authoritarian system. But, encouragingly, the response to the legal change is a sign of the strength of opposition to that drift in a population that cherishes its democratic freedoms.

Students, office workers, artists, migrants and others joined the protests – the biggest in Hong Kong in 30 years – in advance of a vote later this month on the so-called Fugitives Bill, which critics believe could be abused by China to seize dissidents or activists for political reasons. Amnesty International, media outlets and lawyers in the former British colony have pointed to Beijing’s record of arbitrary detention, torture and violation of free-trial rights.

China and its representatives in Hong Kong insist key safeguards would remain in place, including protection against the death penalty, a ban on double jeopardy, and no extradition of suspects for political offences. However, while the Bill proposes judicial oversight, it gives the final say on extradition to the chief executive, or de facto leader, of Hong Kong – an official selected by a committee dominated by Beijing-sanctioned appointees.

China will find it difficult to compromise. In its view, backing down would send a signal of weakness to other territories that might aspire to greater autonomy

Far more is at stake than the extradition Bill itself. When Britain handed Hong Kong back to China in 1997, Beijing agreed to adhere to the “one country, two systems” formula, under which the territory was promised civic freedoms and “a high degree of autonomy” for 50 years. The rule of law and judicial independence were enshrined in that agreement. And, initially at least, the pledge was largely honoured.

Two things have changed in recent years, however. First, the occupy protests rattled the Chinese authorities and led to a gradual contraction of the space in which civic society could operate. Second, the rise of President Xi Jinping broadly coincided with an increasing Chinese assertiveness abroad and a clamping down on forms of activism at home. In Hong Kong, the result of these trends grew increasingly apparent. Bookshops and media outlets were bought up by owners who were close to Beijing. Elected officials were forced to go through tests of “loyalty” to the Chinese government. Even more alarmingly, dissident publishers and business figures disappeared.

China will find it difficult to compromise. In its view, backing down would send a signal of weakness to other territories that might aspire to greater autonomy themselves. But the international community must speak out in defence of Hong Kong’s ever more fragile democracy.