China’s government has responded to a stunning landslide victory for pro-democracy candidates in the Hong Kong elections by emphasising that the city will always be ruled from Beijing, and warning against further protest violence.

The foreign minister, Wang Yi, warned against “attempts to disrupt Hong Kong”, as a few hundred people took to the streets again in support of protesters holed up in a university that has been under siege by police for over a week.

“No matter how the situation in Hong Kong changes, it is very clear that Hong Kong is a part of Chinese territory,” he told reporters on the sidelines of the G20 meeting in Tokyo. “Any attempts to disrupt Hong Kong or undermine its stability and prosperity will not succeed.”

The election results pose a dilemma for Beijing, and Hong Kong’s chief executive, Carrie Lam. Hand-picked to rule by party leaders, Lam always insists she rules independently, but is widely accepted to have coordinated her hardline response to protesters with China’s top leadership.

Before the vote, Lam often claimed she had the support of a “silent majority”, as she escalated the police response to protests, invoked sweeping colonial-era emergency powers, and ruled out meeting any of the protesters’ main demands.

That argument was clearly untenable after pro-government candidates were swept from power across the city, holding on to barely one in 10 seats on district councils. Nearly 3 million ballots were cast; both in absolute numbers and in turnout rates it was the biggest exercise in democratic participation that Hong Kong has seen.

On Monday Lam took a more conciliatory approach, promising to respect the election results and “listen humbly” to the views of the public. Refusing to compromise would almost certainly inflame residents and protesters further, nearly six months into a deep political crisis.

In a reminder of the protesters’ commitment and the volatile situation, by Monday evening a crowd had gathered outside the Hong Kong Polytechnic University, where a handful of protesters were still under siege by police.

A group of newly elected pro-democracy councillors went to meet them inside, making their first public act after the election a clear statement of political intent.

Play Video 1:31 Celebrations in Hong Kong amid landslide victory for pro-democracy candidates – video

Lam’s comments were welcomed by the British foreign secretary, Dominic Raab. There have been frequent calls for the UK to intervene more strongly, as the former colonial power and party to the agreement that promised Hong Kong 50 years of autonomy after the 1997 handover to Chinese rule.

“It was reassuring to hear Carrie Lam commit to reflecting seriously on the message delivered by the people of Hong Kong,” Raab said in a statement. “There is now an opportunity to find a way through the crisis.”

But it was unclear if she has any mandate for compromise from Beijing, which has ultimate authority over the city.

The resounding popular rejection of China’s plans for Hong Kong represents one of the most serious challenges to its autocratic president, Xi Jinping, since he took power in 2012. He is not a leader who has shown much appetite for compromise.

Hours after Wang’s comments, a ministry spokesman, Geng Shuang, also avoided directly commenting on the results but made a fresh attack on the protest movement, which China has repeatedly claimed is being supported by foreign powers seeking to undermine the country.

“The most urgent task for Hong Kong at present is to stop violence, control chaos and restore order,” Geng said, according to reports on state media. “The Chinese government is unswervingly determined to safeguard national sovereignty, and to oppose any interference in Hong Kong affairs by external forces.”

On Weibo, China’s equivalent to Twitter, it was clear that some news had leaked behind the great firewall that cuts the country’s internet off from the world wide web. “Now we can see clearly who is the minority,” wrote one user, in reference to Lam’s frequent claims that the protesters were just a small but vocal group.

Most Chinese media sidestepped mentioning the results when they reported on the elections, saying only that polls had closed in Hong Kong.

There will be few immediate political consequences in Hong Kong because the councils have limited powers, only a small budget and a mandate restricted to hyper-local issues such as parks, bus stops and waste collection.

But these local election victories may sow the seeds of greater long-term influence for democrats, because the councils play a role in choosing the city’s chief executive and some legislators.