Image copyright AFP Image caption Pro-democracy voters celebrating in Hong Kong

Hong Kong's leader Carrie Lam has said the government will "seriously reflect" after local elections saw massive gains by pro-democracy candidates.

Seventeen of the 18 district councils are now controlled by pro-democracy councillors, according to local media.

The election, the first since the wave of anti-Beijing protests began, saw an unprecedented turnout of more than 71%.

It is being seen as a stinging rebuke of Ms Lam's leadership and a show of support for the protest movement.

Hong Kong has seen months of increasingly violent protests since Ms Lam tried to introduce a controversial bill enabling extradition to China.

Image copyright AFP Image caption Carrie Lam has become increasingly unpopular in Hong Kong

In a statement released online on Monday, Ms Lam said the government respected the results.

She said many felt the results reflected "people's dissatisfaction with the current situation and the deep-seated problems in society".

The government would "listen to the opinions of members of the public humbly and seriously reflect", she said.

How did people vote?

Some 2.94 million people voted in the election, compared with 1.4 million in 2015.

Pro-democracy candidates won close to 60% of the total vote on Sunday, but achieved a landslide in terms of seats because of the first-past-the-post system, local media report.

Pro-democracy contenders were victorious in 347 of the 452 district council seats up for grabs; pro-Beijing candidates won 60 seats; while independents - many of them pro-democracy - got 45, according to the South China Morning Post.

In the last election four years ago, pro-Beijing councillors won 298 seats, but the distribution of these seats meant they took control of all 18 district councils.

They retained control of only the Islands District Council after Sunday's vote.

What does it mean for Hong Kong?

The territory's district councillors have little political power and mainly deal with local issues such as bus routes and rubbish collection, so the district elections do not normally generate such interest.

Media playback is unsupported on your device Media caption A winner and a loser in Hong Kong's historic poll result

But the councillors also get to choose 117 of their number to sit on the 1,200-member committee that selects Hong Kong's chief executive, who is then formally appointed by the Chinese government.

The landslide results mean all of those 117 seats are now likely to go to pro-democracy candidates, so they will have a greater influence over that decision, which is set to be made in 2022.

But the result is also highly symbolic, as it was the first opportunity for people to express at the ballot box their view of Ms Lam's handling of the crisis.

The government, and China's leaders in Beijing, had been hoping the election would bring a show of support from the so-called "silent majority" which they say disapproves of the protests.

But that did not materialise - instead some high-profile pro-Beijing candidates lost their seats as voters backed pro-democracy candidates.

The hope from activists is that the overwhelming victory of anti-establishment parties will force the government to take their demands more seriously.

Media playback is unsupported on your device Media caption The history behind Hong Kong's identity crisis and protests - first broadcast November 2019

UK Foreign Secretary Dominic Raab said he welcomed the holding of the elections, which he described as "an important opportunity for the people of Hong Kong to make their voices heard".

"There is now an opportunity to find a way through the crisis with political dialogue that reflects the legitimate aspirations of the people of Hong Kong and respects the one country two systems model," he said.

The challenges facing Carrie Lam and the opposition

By Jonathan Head, BBC News, Hong Kong

So what now? Will the protests resume? It seems almost certain they will, unless the government starts responding to protesters' demands.

Carrie Lam has acknowledged that the results show dissatisfaction with her administration, and promised to listen in a spirit of humility. But she can only make concessions if China agrees. Beijing may prefer to see her replaced by a less toxic figure.

But there are challenges too for the opposition. The new intake of young councillors will have to take on the responsibility of addressing local concerns, like public transport and other amenities, rather than the grander ideals of democracy.

They will need to work together more effectively than they have in the past, and work out how the demands and tactics of more radical protesters can most effectively be channelled to get concessions from a Chinese central government unnerved by yet another show of defiance in Hong Kong.

What does Beijing say?

There has been no official comment from Beijing. But Foreign Minister Wang Yi, speaking in Japan, reiterated that "no matter what happens, Hong Kong is a part of China".

"Any attempt to mess up Hong Kong, or even damage its prosperity and stability, will not succeed," he said.

State media outlets have been cautious in reporting the results.

State news agency Xinhua reported the votes had been counted, but did not detail the results. It said "some rioters harassed patriotic candidates" on election day, and that the "most pressing task for Hong Kong at present is still to bring the violence and chaos to an end and restore order".

Meanwhile, the English edition of state-backed tabloid Global Times attributed the result to the "abnormal" circumstances which made it easier for the pro-democracy camp to mobilise their voters.

It also alleged that "Western forces" have been supporting the opposition.

Ahead of the vote, state media had been urging people to vote for stability and against the unrest.

What is Hong Kong's political unrest about?

Hong Kong, once a British colony, is part of China, but it has some autonomy and people have more rights than on the mainland

That special status is set to expire in 2047, and many in Hong Kong do not want to become "another Chinese city".

The current protests started in June against a planned law which would have cleared the way for criminal suspects to be extradited to the mainland. Many feared this would undermine the city's freedoms or be used to silence anti-Beijing voices.

The bill was withdrawn in September, but demonstrations continued.

Clashes between police and activists have become increasingly violent, with police firing live bullets and protesters attacking officers with bows and arrows or throwing petrol bombs.

The demands of the protesters, mostly young people, have expanded to include genuine universal suffrage and an inquiry into allegations of police brutality.