HONG KONG — Protesters trickled out of a besieged Hong Kong university campus Friday as a week-long siege appeared close to an end, while the city geared up for local elections that pose a test of public support for the pro-democracy movement.

A half-dozen protesters, holding hands and wearing face masks, left Hong Kong Polytechnic University and surrendered to police around dawn, with two more following shortly afterward. That brought to about 30 the number who have turned themselves in over the past day and left only a handful inside.

Police Chief Chris Tang called on the remaining protesters to leave but said there was no deadline to clear them. “The situation is really dangerous inside the campus,” he said. “We encourage them to come out as soon as possible.”

The standoff, sparked by the police shooting of an anti-government protester and the death of another, was the most dramatic escalation in Hong Kong’s more than five months of unrest. Demonstrators pushing back against China’s growing influence on the territory are calling for full democracy and police accountability, among other demands.

Police have said those who surrender could face charges of rioting, which carry a maximum 10-year prison sentence, and there have been fears of more violence if police storm the campus. So far, though, police have been content to wait out the remaining protesters, whose supplies are diminishing inside a campus they had transformed into a fortified base.

“Not all of them want to leave,” said student leader Owen Li. “They still insist on staying and are refusing to be arrested to avoid any unfair circumstances.”

Stung by the arrests of hundreds of protesters this week, Hong Kong’s pro-democracy movement has spent the past few days regrouping and mobilizing for local elections Sunday that it hopes will deliver a resounding message of popular support.

Protesters have refrained from staging large-scale demonstrations in the past few days, either because they needed a break or for fear that trouble could tempt authorities to suspend the vote.

On online forums and message groups, protesters advised one another not to wear black — the unofficial uniform of the pro-
democracy movement — on election day to avoid being detained and denied the right to vote.

A public-opinion poll released Friday showed Hong Kong residents overwhelmingly blame the government and police for the violence that has marred the protests, traumatized the city and sent its economy into recession.

But the protesters did not escape blame, according to the random telephone survey of more than 1,000 people released by the Hong Kong Public Opinion Research Institute.

The survey showed that more than 80 percent of people said the government had to bear responsibility for the violence to a large or somewhat large extent, while just under 40 percent said protesters should bear a large or somewhat large part of the responsibility.

The survey showed trust in the government was very low, but that opinion was divided over whether the protesters were justified in resorting to violence. Three in 4 respondents said that if they could turn back the clock, they wished the protests had never happened.

Some of the city’s working men and women are using their spending power to help front-line protesters confront police during the demonstrations in Hong Kong. (Megumi Lim/The Washington Post)

With the elections approaching, the pro-democracy newspaper Apple Daily created graphics for each of the territory’s 452 district council seats, with photos of each candidate, the pro-democracy camp identified in yellow and the pro-Beijing camp in blue. The paper called the graphics a “mirror to see the monsters,” using a term for pro-government candidates that has become popular among protesters.

But the pro-establishment camp hopes the vote will reveal that ordinary Hong Kongers are fed up with violence and disruption after months of chaos on the streets, and that voters will reject the “black force” of the protest movement.

“The black force say they want to fight for freedom, but now people cannot even express their views freely,” said Starry Lee, who heads the Democratic Alliance for the Betterment and Progress of Hong Kong, the territory’s largest political party. “We have even been stripped of our right to go to school and work.”

Lee and other candidates kicked black soccer balls as symbol of their desire to banish the black-clad protesters.

The district elections are usually fought on local issues and tend to be low-key, with turnout below 50 percent in the last vote in 2015. But both sides are now casting Sunday’s elections as a chance for people to express their opinions on the turmoil roiling the city. For the first time, all the district council seats will be contested.

District councilors’ responsibilities are largely local, but their seats make up a sizable portion of the committee that selects Hong Kong’s chief executive, with the other half handpicked by the Chinese government.

In recent weeks, authorities have arrested several pro-democracy lawmakers and candidates running for district council seats, while barring democracy activist Joshua Wong from running.

There has also been violence against councilors from both sides: Pro-establishment figure Junius Ho was stabbed, and the ear of a pro-democracy district councilor was bitten off during a tussle involving a knife-wielding assailant. Jimmy Sham, an organizer of pro-democracy marches and a candidate in the elections, was attacked by a gang wielding hammers.

Meanwhile, the family of a 70-year-old street cleaner who died during a clash between protesters and residents called Friday for the police to bring his killer to justice. The man had been removing obstacles from a road when a protester threw a brick at his head, police said. He fell into a coma and later died.

“In his life he did not excel, but when he educated us when we were young, he was a great man,” the man’s brother, who was introduced as “Uncle 3,” told a news conference. “He was a man who always helped people. He is the oldest brother; he bore the family responsibilities of our home.”