HONG KONG — Covering their faces with black surgical masks, Guy Fawkes disguises, dish towels and even paper bags, tens of thousands in Hong Kong marched in the territory’s two main districts in defiance of a government ban on face masks, despite fears of violence and pouring rain.

The march, which until late afternoon remained peaceful, underscored the depth of dissent over the new measures that many here believe to be an infringement of their fundamental freedoms. Despite a partial shutdown of the city’s subway system, including stations close to the starting points of the rallies, participants included the disabled in wheelchairs, toddlers and senior citizens.

“To me, banning the masks is an erosion of our basic rights,” said 60-year-old Fred Wong as he marched toward central Hong Kong in a green surgical mask. “We as the older ones should be ashamed of ourselves for not protecting our rights a long time ago, and we should be embarrassed if we don’t come out to fight for the future of the young.” 

The size and diversity of the marches showed that many remain undeterred and unwilling to give up their demands for a more democratic Hong Kong, even as the risks of protest continue to increase.

The Hong Kong government is under growing pressure from authorities in Beijing to quell the anger that has erupted on city streets and end demonstrations that are now in their fifth month. 

Starting at midafternoon, police attempted to disperse the marches in central Hong Kong and in the Kowloon district near Victoria Harbor. Before they started firing tear gas rounds, there had been no confrontations between police and protesters.

Police in the Mongkok neighborhood of Kowloon fired rubber bullets and bean bag rounds at the peaceful crowd. Protesters shined laser lights at them; police escalated to tear gas.

In one particularly dramatic confrontation, a taxi driver in Kowloon appeared to drive deliberately into a crowd of protesters. The crowd pummeled the man, bloodying his face before another group of protesters stepped in to end the attack.

Hong Kong’s Hospital Authority said three people were hospitalized in relation to the protests; two were in critical condition.

By early evening, a core of more militant protesters geared up for clashes with police, now routine after large marches. Outside the city’s High Court building, demonstrators laid bricks down on the road along with traffic cones and metal railings. In what appeared to be a new tactic, they also tied trip wires made of fishing line across a road that has been the scene of charges by police during recent protests. 

Small groups threw petrol bombs and other objects at ­police. 

Police began clearing the crowds with water cannons and tear gas and started arresting protesters. A spokeswoman for the police department did not immediately provide details on the arrests or whether any were charged under the new anti-mask laws. 

Personnel on the roof of the barracks of the People’s Liberation Army in the Kowloon Tong neighborhood raised a yellow flag warning marchers they were breaking the law and could be prosecuted — the first time protesters have elicited a reaction from the Chinese military. Protesters have avoided targeting PLA buildings.

The Hong Kong government described the protesters Sunday night as “a large number of masked rioters” who “took the opportunities to block roads and vandalize public property, [subway] stations as well as banks and shops selected by the rioters in various areas.”

In a statement, the government said it “severely condemns these violent acts which totally disregard law and order.”

Hong Kong leader Carrie Lam invoked sweeping emergency powers to enact the face mask ban, a measure she said was aimed at calming the violence that has grown through the protests.

The protests were sparked by a proposal to allow extraditions to mainland China. That proposal has been withdrawn, but the unrest has swelled into a movement seeking direct elections for Hong Kong’s leaders and an independent investigation into the police. 

Lam’s ban on face masks has so far only provoked more anger. Violence on city streets swelled on Friday night, when dozens of businesses perceived as ­pro-Beijing were vandalized and burned. Some of the same outlets were also targeted on Sunday, along with subway stations, which were badly vandalized.

The city was placed on an effective shutdown on Saturday as the entire subway network, shops and most supermarkets were closed. The subway reopened partially on Sunday but announced it would close all stations at 9 p.m. 

Many here worry that the expanded police powers will only advance a sense of impunity in the department, which has used increasingly harsh tactics to suppress the demonstrations. The presence of riot police has increased throughout the city in recent days; officers are decked out in shields, helmets and sometimes face coverings. 

Protesters have added a new demand: They’re for a complete overhaul of the police force.

“In Hong Kong, we are seeing the police now covering their faces with black masks, almost like they have unlimited rights,” said Yeung, 18, who provided only her last name because the march was unauthorized. She said the law “is being applied with double standards.” 

On Sunday morning, the High Court for the second time ­rejected a temporary injunction on the anti-mask law, this one filed by a group of two dozen pro-democracy lawmakers. The court will still hear a judicial review of the law and the emergency powers used to implement it and has expedited the case.

“The court obviously sees that there is an important constitutional principle at stake concerning our separation of powers, concerning the rule of law in Hong Kong,” Dennis Kwok, a pro-democracy lawmaker who represents the legal sector, said after the ruling. “And that is why the court has agreed to grant us a very fast and quick hearing in the second half of this month.”

Kwok said “we will do our best to fight whether it is in court, whether it is in [the Legislative Council] or whether it is out there with the Hong Kong people.”

Joy Luk, a protester in her 30s, joined the march in central Hong Kong. Luk, who is blind, has become a familiar participant in the demonstrations, with her caretaker and the phone on which she listens to live streams of the events.

On Sunday, for the first time, she wore a mask.

“I have not worn any face masks to the protest in the past because I don’t think my identity would be concealed even if I wear them,” she said. “I am probably the only blind person to go to the front lines of protests.

“But now,” she said, “it is my means of expression against the government. They cannot stop us.”

Tiffany Liang contributed to this report.