HONG KONG — Pro-democracy candidates buoyed by months of street protests in Hong Kong were headed to a stunning victory in local elections on Sunday, as record numbers voted in a vivid expression of the city’s aspirations and its anger with the Chinese government.
It was a pointed rebuke of Beijing and its allies in Hong Kong, and the turnout — seven in 10 eligible voters — suggested that the public continues to back the democracy movement, even as the protests have grown increasingly violent. The surge was driven especially by young voters, a major force behind the demonstrations of the past six months.
With three million voters casting ballots, pro-democracy parties captured at least 216 of 452 elected seats, up from 124, and perhaps many more, according to early official results.
To many democracy advocates, Sunday was a turning point for the movement.
“There has been a very deep awakening of the Hong Kong people,” said Alan Leong, chairman of the Civic Party, one of the largest pro-democracy parties.
The races for district councils, one of the lowest elected offices in Hong Kong, are typically a subdued affair focused on community issues. The job mostly entails pushing for neighborhood needs like bus stops and traffic lights.
But this election took on outsize significance, and was viewed as a referendum on the unrest that has created the city’s worst political crisis in decades. In a semiautonomous part of China where greater democracy is one of the protesters’ biggest demands, it provided a rare chance to vote.
The district councils are one of the most democratic bodies in Hong Kong. Almost all the seats are directly elected, unlike the legislature, where the proportion is just over half. The territory’s chief executive is also not chosen directly by voters, but is instead selected by a committee stacked in favor of Beijing.
The gains at the ballot box are likely to embolden a democracy movement that has struggled with how to balance peaceful and violent protests to achieve its goals. They are also likely to deepen the challenges for China’s central government, which wants to curb the unrest in Hong Kong.
The result might also exacerbate Beijing’s fears about giving the city’s residents even greater say in choosing their government.
Mr. Leong, the Civic Party chairman, called on the Chinese Communist Party to change its policies in Hong Kong.
“Unless the C.C.P. is doing something concrete to address the concerns of the Hong Kong people,” he said, “I think this movement cannot end.”
A few democracy supporters had hoped that the election might give them more sway over the election committee that chooses the city’s chief executive, but that was always seen as a long shot. It was unclear from early results whether that might happen.
Ahead of the election, the city’s leadership was concerned that the vote would be marred by the chaos of recent months. Some of the most violent clashes yet between protesters and the police took place last week, turning two university campuses into battlegrounds.
But the city remained relatively calm on Sunday as voters turned out in droves. Long lines formed at polling centers in the morning, snaking around skyscrapers and past small shops.
David Lee, a retired printer approaching his 90th birthday, was among the earliest voters on Hong Kong Island and said he had come because he wanted democracy.
“This is important,” he said.
Joseph Cheng, a retired professor at City University of Hong Kong, had predicted that pro-democracy candidates would have difficulty making big gains. Pro-Beijing candidates are much better financed, and the district races have traditionally been won on purely local issues, not big questions like democracy.
But voter turnout soared to 71 percent, far surpassing expectations. Typically in district council elections, it is little more than 40 percent. Four years ago, after the 2014 Umbrella Movement increased public interest in politics, turnout climbed to 47 percent. This year, the number of registered voters hit a record.
On Sunday, several prominent pro-Beijing politicians lost their races, among them Michael Tien, a longtime establishment lawmaker. After his defeat, he said the increase in young voters signaled that they were becoming more politically engaged, adding that the government should listen to their voices.
About a hundred revelers celebrated the loss of Junius Ho, a controversial lawmaker many protesters accused of supporting mob attacks against them, with jubilant cheers and champagne.
Regina Ip, a cabinet member and the leader of a pro-Beijing political party, said she was surprised to see so many young voters, many of whom tried to confront her with the protesters’ demands.
“Normally,” she said, “the young people do not come out to vote. But this time, the opposition managed to turn them out.”
Many pro-democracy candidates campaigned on broad issues, hoping to ride the tide of public anger expressed through the protests. Some included protest slogans on their campaign materials.
The intensity of the protests spilled over into the campaign. Candidates on both sides were attacked, as were activists. Riot police officers were deployed near polling stations on Sunday.
A steady stream of voters continued well after sunset at the Yau Ma Tei Community Center polling station in Kowloon, nestled between a street market famous for jade and the graceful banyan trees of an ancient temple.
Mandy Lee, 53, a homemaker who voted at the Kowloon Bay neighborhood, showed up to vote for the pro-Beijing establishment and criticized the protests.
“It’s not that I have no sympathy toward young people, but I strongly believe that their efforts are futile,” she said. “We are a tiny island; it’s only a matter of time before China takes us over and integrates us.”
The outcome of the election could further complicate the position of Carrie Lam, Hong Kong’s embattled chief executive. Critics say that she has failed to engage with the community over the protests and that she has not listened to people’s concerns.
In June, Mrs. Lam set off enormous protests by pushing ahead with a bill that would have allowed the extradition of Hong Kong residents to the opaque judicial system in mainland China. The issue played to deeper worries about Beijing’s encroachment on Hong Kong, which has maintained its own political and judicial system since the former British colony was reclaimed by China in 1997.
Mrs. Lam withdrew her proposal after months of protests, but it may have been a move that many critics considered too late. The protesters now maintain that several other demands must also be met, including the introduction of universal suffrage and an independent inquiry into police conduct.
With Sunday’s gain for pro-democracy forces, the district councils may now have more sway in picking the next chief executive, in 2022. The camp that holds a majority of district council seats could choose as many as one-tenth of the electors for a new, 1,200-member election committee.
The performance of the pro-Beijing parties on Sunday suggests their support for the unpopular extradition bill hurt their image with voters. It also shows that their ability to galvanize voters has limits.
Many of the establishment groups receive large donations from the Hong Kong subsidiaries of state-owned enterprises in mainland China, which allows the pro-Beijing parties to host many picnics and other social events for their supporters, who are often older.
Matthew Cheung, the chief secretary and second-highest official of the Hong Kong government, vowed on Sunday during the voting that the city’s leadership would pay close attention to the results of the vote no matter how it turned out.
“The election is an important political thermometer,” he said. “We will definitely take it seriously.”
Katherine Li contributed reporting.