Hong Kong’s days as an international city with a high level of autonomy from mainland China now appear to be numbered, following a decision by China’s rubber-stamp parliament Thursday to press ahead with a new national security law that will criminalize acts such as protesting and criticizing Beijing.

The move, although widely expected, is nonetheless a shocking development for the people of Hong Kong and international corporations that have built their Asia operations in the former British colony. Many in Hong Kong fear China will use these provisions to intimidate and punish critics of the government in Beijing.

“This fundamentally changes the landscape for both the rule of law and for the rights and freedoms of Hong Kong,” said Antony Dapiran, a Hong Kong-based lawyer and author of the new book “City on Fire: The Fight for Hong Kong.”

“Beijing is imposing this law over the heads of the duly elected legislature and in contravention of the Basic Law,” he said, referring to the mini-constitution that has allowed Hong Kong to enjoy relative freedoms under a “one country, two systems” framework agreed when Britain handed control of the city back to China in 1997. “This law will mean whatever Beijing wants it to mean, and that has serious implications.”

Hong Kongers have faced down riot police to protest the plan this week. Hundreds of them, including schoolchildren in uniform and others who were simply shouting slogans, were apprehended.

Western governments have broadly condemned the plan, but none more forcefully than the Trump administration, which looks set to strip Hong Kong of its special status and impose other punishments on Beijing.

China has been steadily encroaching on Hong Kong’s supposed autonomy in recent years, from seizing book store owners who had been selling volumes critical of the Communist Party in 2015, to promoting a law this week that would make it a crime to insult the Chinese national anthem.

But the new law constitutes Beijing’s boldest move yet to undercut the city’s autonomy and take full control of its legal and security structures. Now, 23 years into the 50-year agreement between Britain and China, Beijing is seeking to seize control of key parts of the city’s legal system.

Wrapping up its annual meeting Thursday, China’s National People’s Congress approved a plan to “improve” the legal system and safeguard national security by drafting a law that will allow it to deploy “relevant national security organs” to Hong Kong.

A total of 2,878 deputies voted in favor of the plan, while one voted against and six abstained, according to television footage from inside the Great Hall of the People.

“This is a major development in the practice of ‘one country, two systems,’ and is also in keeping with China’s Constitution and the Basic Law of the Hong Kong Special Administrative Region,” Li Zhanshu, chairman of the NPC’s standing committee, said at the closing of the conclave.

The People’s Daily, the mouthpiece of the Communist Party, said Thursday that the law was needed to get Hong Kong out of its “chaotic quagmire.”

The standing committee will draft the full text of the law, which should be passed by August, but the outlines have already been well telegraphed: The new legislation will criminalize “foreign interference,” terrorism, secessionist activities and subversion of state power.

China has frequently called the pro-democracy demonstrators who took to the streets of Hong Kong last year “terrorists,” raising fears that Beijing would use the law to target political dissidents, and officials have made it clear that those protests were the trigger for the new law.

Wang Chen, vice chairman of the NPC standing committee, said last week that “new problems and challenges” had caused Beijing to proceed with the legislation instead of continuing to wait for Hong Kong to enact its own national security law.

Hong Kong officials were supposed to introduce their own national security provisions under the Basic Law, but they shelved an effort to introduce them in 2003 after massive public protests.

Carrie Lam, Hong Kong’s Beijing-backed chief executive and a delegate to the NPC, welcomed the move Thursday and pledged to “enhance enforcement and public education” to help safeguard national security.

The legislation was aimed at “an extremely small minority of criminals who threaten national security, safeguarding the prosperity and stability of Hong Kong,” she said in a statement.

“It will not affect the legitimate rights and freedoms enjoyed by Hong Kong residents,” she added. Last week, Lam said Hong Kong people have the freedom to say whatever they want “for the time being.”

Bar associations from Hong Kong to New York have expressed grave concerns about the new law, and legal experts say the legislation seems specifically designed to stop the kinds of protests against China that broke out in Hong Kong last year.

“Beijing’s official explanation gave me the feeling that the legislation will aim to prohibit those activities and conduct,” said Eric TM Cheung, a law professor at the University of Hong Kong.

“It’s quite alarming. This means that advocating for self-determination or independence or anti-government protests could all be branded as seriously endangering national security,” Cheung said.

Since the 1997 handover, Hong Kong has enjoyed freedoms of expression and assembly that are unimaginable on the mainland, most obviously on June 4 each year, when huge vigils take place in Hong Kong to remember the victims of the 1989 Tiananmen Square massacre in Beijing.

The vigil has already been banned this year on grounds that it is not safe to gather during the coronavirus pandemic.

Many details about the law remain unknown, including how the people arrested under it would be tried.

The Hong Kong-based South China Morning Post reported Thursday that people charged with national security offenses would not be sent to the mainland for trial, and that key principles would continue, such as the presumption of innocence until proven guilty and a requirement of proof beyond a reasonable doubt.

Cheung said he would be watching to see what safeguards were built into the system, especially whether the Hong Kong courts had the power to hear and decide on cases.

The developments are certain to further worsen relations between China and the United States.

Tensions between Beijing and Washington have been growing steadily over the two past years, with the world’s two largest economies clashing on matters including trade and technology, human rights and press freedom. Beijing last year repeatedly accused the United States of fomenting the protests in Hong Kong.

But their relationship has become outright hostile this year with the emergence of the new coronavirus in China, which has now killed 100,000 people in the United States. The Trump administration is blaming Beijing for allowing the virus to spread, with some officials suggesting, without proof, that the ruling Communist Party deliberately “seeded” it overseas.

President Trump said Tuesday that his administration was “doing something now” about the situation in Hong Kong, and Secretary of State Mike Pompeo said Wednesday that he has advised Congress that Hong Kong no longer warrants the special treatment afforded to it since the handover.

“No reasonable person can assert today that Hong Kong maintains a high degree of autonomy from China, given facts on the ground,” Pompeo said in a statement. “It is now clear that China is modeling Hong Kong after itself.”

Many analysts now expect the Trump administration to strip Hong Kong of its special status, a move that would essentially mean that the United States would treat Hong Kong residents and companies in the same way it treats Chinese ones.

“This is not something that we should resort to immediately,” said Bonnie Glaser, director of the China Power Project at the Center for Strategic and International Studies, describing the move as “the nuclear option.”

“This will have all sorts of negative impacts on Hong Kong and would harm many Hong Kongers in many ways,” she said.

This includes requiring Hong Kong residents to get a visa to travel to the United States — as mainland Chinese do — and it would mean that Hong Kong exports would be subject to the tariffs that the United States imposed on China during the trade war.