The Hong Kong government's decision to use a colonial-era emergency law to ban face masks at protests last year was both proportionate and legal, the city's top court ruled Monday.

The ruling is a blow for democracy supporters who had been hoping the Court of Final Appeal would side with a lower court and overturn the order.

It also confirms that Hong Kong's chief executive — a pro-Beijing appointee — has the power to enact any law in a time of public emergency without needing the approval of the city's partially elected legislature.

Hong Kong was convulsed by seven straight months of huge and often violent pro-democracy protests last year.

They were eventually quashed by mass arrests, a coronavirus ban on public gatherings and Beijing imposing a new national security law on the city in June.

Face masks became ubiquitous as a way to reduce the risk of identification and prosecution for those taking part in peaceful marches or violent clashes with police.

In October last year, Chief Executive Carrie Lam banned anyone covering their face at public rallies using the Emergency Regulation Ordinance, a British colonial law from 1922.

Opposition lawmakers challenged both the use of that emergency law and the ban on wearing masks at permitted rallies.

They argued the move breached Hong Kong's "Basic Law" — the city's mini-constitution.

A lower court had agreed with those bringing the challenge and expressed concerns about the emergency law and the proportionality of the face mask ban.

But on Monday, a panel of top judges unanimously backed the government.

"The ambit of the power to make subsidiary legislation under the ERO in a situation of emergency or in circumstances of public danger, although wide and flexible, was not unconstitutional," the judges ruled.

Banning face masks at both illegal and legal rallies was proportionate because it was aimed at "the prevention and deterrence of violence before a peaceful public gathering had deteriorated into violence."

The ruling comes at a time when Hong Kong's government has made the wearing of face masks in public compulsory for much of the year to combat the coronavirus pandemic.