Police firing tear gas have evicted protesters who stormed and vandalised Hong Kong's parliament.
Activists had occupied the Legislative Council (LegCo) building for hours after breaking away from a protest on the anniversary of Hong Kong's transfer of sovereignty to China from Britain.
After midnight (16:00 GMT), hundreds of police secured the building following a warning to protesters to clear it.
It follows weeks of unrest in the city over a controversial extradition law.
Hundreds of thousands took part in the earlier peaceful protest - the latest rally against a proposed law that critics fear could be used to extradite political dissidents to mainland China.
The protesters have also been demanding an independent inquiry into alleged police brutality during an earlier protest on 12 June.
Hong Kong's embattled political leader Carrie Lam held a press conference at 04:00 local time (20:00 GMT) in which she condemned the "extreme use of violence" of those who broke into the legislature.
How did the day unfold?
Peaceful demonstrations had been planned for Monday, the 22nd anniversary of the handover of sovereignty.
A large-scale march, involving hundreds of thousands of people, took place in the city, and passed off in a largely peaceful manner.
Separately, officials from the government raised glasses of champagne at a formal ceremony celebrating the handover.
But at about lunchtime, dozens of demonstrators broke off and made their way to LegCo. They effectively besieged the building, as a large crowd of several hundred watched from a distance, before eventually smashing their way through the glass facade.
Pro-democracy legislators at the scene had attempted to dissuade them from breaking into LegCo, warning them they could face serious criminal charges for doing so.
One of the lawmakers, 66-year-old Leung Yiu-chung, said their pleas were ignored, with many protesters telling him they were prepared to face the consequences.
Police warned the crowd they would use force and make arrests, but fell back to an interior gate before vacating the building, rather than engage the crowd. Hundreds more flowed in once the police left.
Inside, they defaced the emblem of Hong Kong in the central chamber, raised the old British colonial flag, spray-painted messages across the walls, and shattered furniture.
Then at about midnight outside the building, protesters clad in plastic helmets and brandishing umbrellas retreated from a baton charge by riot police, who quickly overcame their makeshift barriers.
Inside, diehard protesters were pulled forcibly outside by their fellow occupants in an attempt to completely clear the building.
Democratic lawmakers Ted Hui and Roy Kwong stood in front of police asking them to allow demonstrators time to leave the area, the South China Morning Post reported.
Within an hour, the streets around the building were clear of everyone except the media and police. Officers then began searching the rooms of the LegCo building for any possible stragglers. No arrests have yet been reported.
Why didn't protesters stay?
One pro-democracy legislator told the BBC that young protesters initially said they would stay all night.
"They're saying that they would beat the police by sheer numbers, and that sounds very scary to me," Claudia Mo said.
"I was a journalist and I did cover the Tiananmen bloodbath 30 years ago, and that's exactly what those students said back then in the Chinese capital."
Her colleague, legislator Fernando Cheung, had been inside with those occupying the building, and said he was glad they all left safely without encountering police.
"If they resisted... I'm afraid there would be bloodshed, or I think the police wouldn't be hesitant to use force to disperse them," he said.
He praised those who came back and grabbed those who refused to leave. "They came back and they dragged them out. And we're actually glad that happened," he said.
What did Carrie Lam say?
In the early hours of Tuesday morning, Ms Lam called a press conference in which she denounced the "extreme use of violence and vandalism" by protesters who stormed parliament.
Flanked by her security minister John Lee Ka-chiu and other officials, Ms Lam said the break-in "really saddens a lot of people and shocks a lot of people".
She contrasted Monday's tumultuous events with the annual peaceful march on 1 July, which she said reflects "the core values we attach to peace and order" in Hong Kong.
The press conference, held outside Hong Kong's police headquarters, was frantic, with a chorus of reporters shouting questions at Ms Lam.
Ms Lam responded calmly, showing little emotion as she stressed the importance of maintaining the rule of law in Hong Kong.
"I hope the community at large will agree with us that with these violent acts that we have seen, it is right for us to condemn it and hope society will return to normal as soon as possible," she told reporters.
In an apparent warning to protesters, Ms Lam said Hong Kong's authorities would "pursue any illegal acts" carried out by protesters.
Why is there unrest?
Hong Kong enjoys a "one country, two systems" deal that guarantees it a level of autonomy, and rights not seen on mainland China.
However, it does not have full democracy, and pro-democracy events are held every year to mark the handover.
This year, however, the annual event follows weeks of protests which have seen millions take to the streets over the planned extradition bill.
On 12 June, police used tear gas and rubber bullets to break up an unauthorised demonstration outside LegCo, where a debate about the bill was due to take place - but critics said it used excessive force.
In the wake of June's protests, the government apologised and suspended the planned extradition law.
However, many protesters said they would not back down until the bill had been completely scrapped.
There have also been smaller demonstrations by the territory's pro-Beijing movement.
On Sunday, thousands of pro-Beijing protesters rallied in support of the Hong Kong police.