HONG KONG--Hong Kong’s Court of Appeal on Thursday partially overturned a lower court ruling that a government ban on face masks was unconstitutional, at a time that most Hong Kong people are wearing masks in the hope of warding off the new coronavirus.

In October, during the height of anti-government protests, Hong Kong leader Carrie Lam invoked colonial-era emergency powers for the first time in more than 50 years that allowed her to enact a new regulation banning face masks.

At the time, many protesters were wearing masks to hide their identities from the authorities.

The dramatic ban on masks was later ruled unconstitutional by the High Court, a decision that riled Beijing and led to an appeal.

The Court of Appeal ruled on Thursday that while the government had the right to ban the wearing of masks at unlawful assemblies, a ban on masks at legal public gatherings was unconstitutional.

In addition, the court found that providing the police with powers to remove facial coverings was also unconstitutional.

The Court of Appeal said the overall right of the government to invoke the Emergency Regulations Ordinance (ERO) was constitutional in time of “public danger”.

The Department of Justice has five days to appeal against the ruling.

The decision comes at a time when an already deeply ingrained culture of mask-wearing has become even more pronounced as most of the city’s 7.4 million people don surgical hoping to protect themselves from the coronavirus.

Under the anti-mask law, it was illegal to wear a mask at both lawful and unlawful assemblies and offenders could be sentenced to one year in jail and a fine of HK$25,000 (346,601 yen).

People who need to wear face masks for health, religious or job-related reasons were exempt, although critics of the ban said it could cause confusion.

Police were also given the power to order people to remove masks for identity verification. Those who refused to do so could be sentenced to six months in prison or a HK$10,000 fine.