The Hong Kong government’s ban on face masks at demonstrations got a defiant response Friday, with thousands of masked protesters turning out to show their opposition to the new law.

As news spread of the ban, which activists and rights groups slammed as draconian, protests broke out around the city, with participants donning blue surgical masks and chanting: “Hong Kong people, resist.”

Tensions boiled over in the town of Yuen Long, where an off-duty police officer shot a man in the thigh after his car was surrounded by angry protesters, local media reported. The officer was then reportedly beaten by the crowd, and had a petrol bomb thrown at him, before he ran off for reinforcements.

While the ban isn’t due to come into effect until midnight (12 p.m. ET), protesters were already making plans online for protests to openly flout the law Saturday — including a demonstration in which marchers would don Halloween masks.

Hong Kong chief executive Carrie Lam, desperate to bring an end to nearly four months of increasingly violent unrest in the semi-autonomous Chinese city, invoked the ban Friday using colonial-era emergency powers not used for more than 50 years. She said she hoped the ban would be a deterrent to violent behavior by protesters.

“We must stop the violence,” she said. “We can’t just leave the situation to get worse and worse.”

Amid escalating tensions between police and protesters, an officer shot an 18-year-old high school student point-blank in the chest Tuesday. The shooting, which narrowly missed the victim’s heart, marked the first time a protester has been shot by live ammunition, and prompted fresh outrage from the public, which only grew when police exonerated the officer and charged the protester instead.

The new order bans protesters from wearing full or partial face coverings at public gatherings, whether authorized by the police or not. Violators face up to a year in jail and a fine of HK$25,000 ($3,190).

People who need to wear masks for their work, or for religious or medical reasons, are exempt. The government’s Security Secretary John Lee said police would be allowed to wear them as part of their protective gear, but said individual officers could be identified even if masked, if necessary, through other means.

Many protesters in Hong Kong wear masks to remain anonymous, fearing criminal prosecution or other forms of persecution by China’s powerful state security apparatus. Many also wear goggles and industrial respirators as protection against police tear gas.

Hong Kong justice chief Teresa Cheng said Friday that the government believed the new law would not impinge on protesters’ civil rights, as they still had freedom to assemble if they took off their masks. Similar laws banning masks exist in other countries, including Australia, Canada, France and Germany.

But activists and rights groups condemned the move as a heavy handed measure that failed to take heed of protesters’ legitimate concerns about their security, amid widespread complaints of police brutality.

“It is thanks to the climate of fear Hong Kong authorities have created that protesters feel the need to wear masks in the first place,” said Joshua Rosenzweig, Head of Amnesty International East Asia. A recent Amnesty investigation found that Hong Kong police were committing reckless and indiscriminate violence against pro-democracy protesters, including assaults in custody that amounted to torture.

“This ban is especially worrying in a context where protesters fear arbitrary arrest, surveillance, and the indiscriminate use of tear gas and other projectiles,” he said.

Prominent pro-democracy activist Joshua Wong said that the government’s invoking of emergency powers was the “real danger,” and marked the city’s further slippage into becoming a police state.

Anger at the government was on full display in the city’s busy Central district, where protesters tore down and set fire to a prominent banner celebrating Tuesday’s 70th anniversary of the founding of the People’s Republic of China.

With many Hong Kongers expressing their intention to defy the ban — including veteran pro-democrat politician Emily Lau, who told VICE News “I’ll go out and wear one too” — Hong Kong’s government is reportedly anticipating pushback. The city’s pro-Beijing Sing Tao Daily newspaper reported that the government expected some protesters would not obey the law, but hoped that it may deter others.