Updated

Hong Kong was poised on the edge of confrontation between police and pro-democracy protesters Thursday as authorities warned demonstrators not to follow through on their threat to occupy government buildings if the city's chief executive does not step down by the end of the day.

Police spokesman Steve Hui said Thursday that authorities would not tolerate any illegal surrounding of government buildings and urged the protesters to remain calm and restrained.

The protesters have blocked main roads surrounding the city's government quarters since late last week to demand the resignation of Leung Chun-ying, as well as broader changes in political reform plans devised by Beijing. In August, the Chinese government ruled that candidates for the city's chief executive position would have to be pre-screened by Beijing.

Late Thursday afternoon, hundreds of young protesters crowded in front of the gate to the territory's government headquarters, spilling around the sides of the huge building and across the street. Many donned face masks and goggles, some had gas masks and rain capes — all precautions in case police might use tear gas and pepper spray, as they did last weekend to try to disperse demonstrators.

"We can't just sit here forever because we can't achieve what we want. We hope to have a direction with actions soon, not just sit here aimlessly," said Maness Ko, a 21-year-old college student.

Hui told reporters that blocking or occupying government buildings would lead to "serious consequences."

The students remained watchful but calm, looking on as police brought in tubs of gear, including some labeled "rubber batons." Each change of police shift brought on a ruckus as students resisted but eventually gave way after being reassured they could reoccupy the pavement outside the government compound's gate.

"We are not asking C.Y. to come talk to us. We are demanding he resign," said May Tang, a 21-year-old student at Lingnan University, referring to Leung. "It's too late for his government to be accountable to the people so we want a new one."

Some protesters said they disagreed with the student leaders' threat to occupy government buildings.

"Getting into a confrontation with police doesn't seem peaceful to me," said Wilson Yip, a 22-year-old recent university graduate. "If they try to force themselves inside and confront police, I don't see what kind of point that would make. It may make fewer people support the protests."

On Wednesday night, protesters and police engaged in a tense standoff that led to police forming a human cordon inside the government compound's gates.

The weeklong street protests by thousands of demonstrators pressing for more open elections in Hong Kong are the biggest challenge to Beijing's authority since China took control of the former British colony in 1997.

China's ruling party mouthpiece warned of "chaos" in Hong Kong, and expressed strong support for Leung in his face-off with the pro-democracy protesters.

The People's Daily said in a commentary that the "central government fully trusts Chief Executive Leung Chun-ying and is very satisfied with his work." It added that it firmly supports the Hong Kong police -- criticized for using tear gas and pepper spray on the protesters last weekend -- "to handle illegal activities in accordance with the law."

Thursday's commentary in the People's Daily is a reflection of the growing concern in Beijing that the protests could spiral out of Leung's control. But the Communist Party is known to send mixed signals at times, and such public support for Leung could also mean that Beijing is holding him responsible for bringing order quickly and decisively.

The commentary also said that the rule of law must be safeguarded "in order to realize the healthy development of democracy and politics in Hong Kong."

The protesters' chief complaint is over Beijing's decision in August that all candidates in an inaugural 2017 election for the territory's top post must be approved by a committee of mostly pro-Beijing local elites. They say China is reneging on its promise that the chief executive would be chosen through "universal suffrage."

The Associated Press contributed to this report.