China's mainland government condemned demonstrations rocking Hong Kong on Tuesday as a challenge to Beijing's authority that "trampled" the law and required swift prosecution, but protesters were undeterred.

The ominous warning was issued hours after protesters, angry at Beijing's growing control over Hong Kong's affairs, stormed the city's legislative building and occupied the governing chamber. The occupiers spray-painted pro-democratic slogans on the walls and tore down pictures of lawmakers before retreating. Police used tear gas to disperse crowds gathered outside the building.

“Such serious illegal acts trampled on Hong Kong’s rule of law, damaged Hong Kong’s social order, harmed Hong Kong’s interests – it is a blatant challenge to the bottom line of ‘One Country, Two Systems,' ” Hong Kong's liaison office to China's ruling State Council said in a statement.

The office said it would firmly support the Hong Kong government's prosecution of those behind the "atrocities."

The Global Times, a mouthpiece publication for Beijing, published commentary criticizing the "mob-like behavior" that it said no Western government would allow.

"Chinese society is all too aware that a zero-tolerance policy is the only remedy for such destructive behavior," the Global Times said. "Otherwise, and without this policy, it would be similar to opening a Pandora's Box, upending social disorder."

The assault on the Legislative Council building Monday came as hundreds of thousands gathered for the latest in a series of protests of a contentious proposal that would allow extradition of Hong Kong residents to China.

The event, which marked the 22nd anniversary of the former British colony's return to Chinese rule, grew violent when some of the protesters smashed through glass doors and stormed the legislative offices. Police in riot gear fired tear gas to chase crowds away from the building, but those who breached the chamber left before police carried out a warning to use force to evict the occupiers.

Hong Kong Chief Executive Carrie Lam, who has faced criticism from pro-democracy leaders demanding her resignation, said the government would pursue those involved in the occupation.

“The march was peaceful and generally orderly,” she said. “The second scene … was the extreme use of violence.”

Joshua Wong, a leader of the pro-democracy movement, said the protests will continue. He defended the behavior of those who smashed their way into the council chamber, saying they destroyed "signs of tyranny" but preserved antiques and even paid for "cans of drinks even though no officers" were present.

The unrest was the latest in a series of often huge and sometimes violent demonstrations against Hong Kong's leadership. Hong Kong operates under a framework that was supposed to include the right to retain its own social, legal and political systems for 50 years after its handover to Chinese rule in 1997.

The mainland government has steadily encroached on that autonomy.

"Events in Hong Kong are about so much more than the bill, more than Lam, more even than democracy," Wong tweeted. "In the end it is about the future of Hong Kong beyond 2047, a future that belongs to our generation."