HONG KONG — In the run-up to local elections in Hong Kong on Sunday, Beijing and its allies in the city were portraying the vote as a way to hear the voice of a silent majority after nearly six months of increasingly violent antigovernment protests.

Now, that majority has spoken — and it has come out overwhelmingly against Beijing and its allies.

The city’s Beijing-backed establishment camp suffered a staggering defeat in elections for district councils as democracy advocates swept 87 percent of the seats, up from less than a third. Beijing and its supporters in Hong Kong, including the city’s embattled leader, Carrie Lam, must now reckon with a resounding, very public display of support for the democracy camp and the protest movement.

“This election is not just about livelihood issues, but also a direct referendum regarding the justifiability of this regime,” Cary Lo, a newly elected district councilor supporting democracy, told reporters on Monday. “It has indicated that Carrie Lam’s government has lost its legitimacy.”

What all sides agree on is that the election landslide puts China’s ruling Communist Party under even greater pressure to respond to the protest movement. Where their views differ is on what it means.