Image copyright AFP Image caption Protesters have been camped on roads around government buildings for several days

Pro-democracy protesters in Hong Kong have surrounded two key government buildings in the territory.

They have massed outside the office of Chief Executive CY Leung, demanding that he resign by midnight, and the Central Government Complex.

Police have warned protesters not to try to breach the police cordon protecting the buildings.

Protesters are angry at China's plan to vet candidates for polls in 2017, saying they want full democracy.

At a press conference ahead of the expiration of the protesters' deadline demanding his resignation, Mr Leung announced that his government was willing to hold talks with the protesters - but refused to resign.

He said the chief secretary of the territory, Carrie Lam, would open a dialogue with student leaders as soon as possible.

"The Hong Kong government is always willing to discuss the [political] reforms," he said.

Media playback is unsupported on your device Media caption Steve Hui, Hong Kong police spokesman, said the force would "not tolerate any illegal surrounding of government buildings"

Mr Leung said the protesters around government buildings had so far been "very rational and restrained", adding: "I hope they will continue to be like that."

However, he warned that gatherings outside government buildings were against the law, and that any attempt to occupy official buildings would be met with a police response.

Photographs taken at the government buildings site suggest that rubber bullets and riot gear are being stockpiled by police.

The police and Hong Kong government were criticised for using tear gas to disperse protesters last weekend.

At the scene: Juliana Liu, BBC News

Warnings from police and government officials in Hong Kong against continuing the protests have not succeeded.

A steady stream of demonstrators wearing yellow ribbons have been arriving at the main demonstration site, although overall numbers appear to have fallen since earlier in the week. The organisers have said it was due to exhaustion, as the protest completes its fifth day.

Tension, though, was growing as crowds moved away from Connaught Road to an area outside the chief executive's office. That was where police officers were earlier photographed bringing in what appeared to be rubber bullets and other riot gear.

Demonstrators debated how much force the officers might use against young student activists who had threatened to occupy government buildings.

With a deadline of midnight for the chief executive to resign, the crowds are likely to swell as demonstrators wait to see if student leaders carry out their promise to escalate their civil disobedience campaign.

Police spokesman Steve Hui told reporters that if protesters surrounded and occupied Mr Leung's office, this would cause public safety problems.

"The police will not stand by and watch. We will decisively uphold the law," he said.

When asked if tear gas would be used, Mr Hui said the police would monitor the situation and would use "appropriate force if necessary".

Image copyright AP Image caption Earlier, police officers were seen carrying canisters labelled "riot" and "batons" into the government compound

The Hong Kong government said in a separate statement that the protesters were conducting a "siege" and, if it continued, government and police operations would "be seriously affected".

"This will eventually affect social order and the provision of government services to the public and society," it said, adding that 3,000 government officials were due to return to work on Friday.

'Disrespecting the law'

China's state media have strongly backed Hong Kong's chief executive, praising his performance while condemning protests as "chaos".

The Chinese Communist Party's official newspaper, People's Daily, praised Mr Leung's handling of the situation in a front-page editorial on Thursday.

"The central government is full of confidence in Chief Executive Leung Chun-ying, and is completely satisfied with his performance," it said.

Media playback is unsupported on your device Media caption Ali Moore: Have Hong Kong protests hit the shopping industry?

Beijing "will thus continue to strongly support Mr Leung's leadership of Hong Kong's legal administration as well as the police's handling of illegal activities", it added.

People's Daily also carried on its website a comment piece from another newspaper which stated: "Hong Kong has for many years enjoyed peace and harmony.

"It now sees the emergence of this embarrassing chaos, and the root cause lies with a few people who are disrespecting the law.

"Chaos denies Hong Kong residents their prosperity, goes against their wishes, and is not what all Chinese people wish to see or what we can tolerate."

Hong Kong democracy timeline

1997: UK gives Hong Kong back to China under a 1984 agreement giving it "a high degree of autonomy" for 50 years

2004: China says it must approve any changes to Hong Kong's election laws

June-July 2014: Pro-democracy activists hold an unofficial referendum on political reform; both sides hold large rallies

31 August 2014: China says it will allow direct elections in 2017 but will pre-approve candidates

22 September 2014: Student groups launch a week-long boycott of classes

28 September 2014: Occupy Central and student protests join forces and take over central Hong Kong

2017: Direct elections for chief executive due to take place

2047: Expiry of current agreements

Q&A: Hong Kong's democracy controversy

Are you affected by the protests? Get in contact by emailing haveyoursay@bbc.co.uk.

Send your pictures and videos to yourpics@bbc.co.uk or text them to 61124 (UK) or +44 7624 800 100 (International). If you have a large file you can upload here.

Read the terms and conditions