China has formally adopted a controversial security law, giving it new powers over Hong Kong and deepening fears for its freedoms.
It is set to criminalise secession, subversion and collusion with foreign forces, but will also effectively curtail protests and freedom of speech.
The move follows increasing unrest and a widening pro-democracy movement.
Pro-democracy organisation Demosisto reacted to the news by announcing it was ceasing all operations.
Earlier Joshua Wong, one of Hong Kong's most prominent activists, said he was leaving the group, which he had spearheaded.
But some other veteran activists have said they will join a key march on Wednesday, despite the risk of arrest under the new law.
China's state news agency, Xinhua, confirmed that President Xi Jinping had now signed the security law. It has been added to Hong Kong's Basic Law, the 50-year mini-constitution agreed when the territory's sovereignty was returned to China by the UK in 1997.
Its terms are not yet clear, meaning residents still do not know the measures they will have to abide by. The law could be implemented as early as Wednesday.
UK Foreign Secretary Dominic Raab expressed "deep concern" at the reports the law had been passed, saying: "This would be a grave step."
The law has sparked demonstrations in Hong Kong since it was announced by Beijing in May. China says it is needed to tackle unrest and instability and rejects criticism as interference in its affairs.
What does the new law do?
The law went through unanimously in a session of the Standing Committee of the National People's Congress in Beijing.
It comes a day before the 23rd anniversary of the handover from Britain to China - a date usually marked by pro-democracy protests.
It will make criminal any act of secession, subversion of the central government, terrorism and collusion with foreign or external forces.
A new office in Hong Kong would deal with national security cases, but would also have other powers such as overseeing education about national security in Hong Kong schools.
In addition, the city will have to establish its own national security commission to enforce the laws, with a Beijing-appointed adviser.
Hong Kong's chief executive will have the power to appoint judges to hear national security cases, a move which has raised fears about judicial independence.
Importantly, Beijing will have power over how the law should be interpreted. If the law conflicts with any Hong Kong law, the Beijing law takes priority.
How will it change Hong Kong?
For many, the law undermines the freedoms that set Hong Kong apart from the rest of China and helped define its character.
People in Hong Kong prize civil liberties such as free speech, the right to protest and an entirely independent and robust judiciary, as permitted in the Basic Law.
In recent years, Hong Kong has seen waves of protests demanding more rights. Last year, rallies over a now-scrapped bill permitting extraditions to the mainland turned violent and fuelled a broad pro-democracy movement.
In a video address to the UN Human Rights Council on Tuesday, Chief Executive Carrie Lam said crimes under the new law would be clearly defined.
She said the law would only target a "small minority" and would not undermine Hong Kong's autonomy, adding: "We respect differences in opinion."
'A tool to suppress political agitation'
Hong Kong's sweeping new security law is a frighteningly open-ended tool to suppress political agitation. Like similar laws on the Chinese mainland it appears that it can be manipulated to meet the needs of the Communist Party as required to crush almost any action deemed threatening.
Unlike elsewhere in China, Hong Kong has an independent judiciary. For this reason, the Party's leadership was not going to leave interpretation of this law in the hands of just any old judges.
No. Those who will be allowed to preside in these matters will be hand-picked by Carrie Lam, the city's leader who was effectively installed by Beijing.
So, prior to the new security bill, which actions by activists - no matter how subversive - could not be dealt with under existing laws? What were "extremists" getting away with to warrant this new legislation?
Bomb making? No. Smashing up buildings? No. Meeting with international NGOs to talk about the city's deteriorating freedoms? Ahhhh. Perhaps. Publicly advocating Hong Kong independence? Almost certainly.
The more that Beijing, under Xi Jinping's leadership, has sought to control Hong Kong, the more it has driven residents into the pro-democracy camp.
But he is playing a long game. Sure, handover promises to the UK were made but he was not going to let some Western attachment to liberty trump loyalty to the motherland. Not on his watch. Enter the security law.
What has the reaction been?
Democratic Party leader Wu Chi-wai said he would defy a police ban on Wednesday's "handover day" march.
He will be joined by Figo Chan, of the Civil Human Rights Front, who urged people to take to the streets, saying: "We are aware of the risks of being prosecuted. But we insist on taking the lead, as we want to tell Hongkongers not to fear."
Police plan to have 4,000 riot officers on standby, the South China Morning Post reports.
Announcing that it would "dissolve and stop all meetings", the Demosisto group said that the fight against "totalitarian oppression" would have to continue in a "more flexible manner" and on "different fronts".
Joshua Wong said the law marked "the end of Hong Kong that the world knew before".
President of the European Council Charles Michel said on Tuesday the law risked seriously undermining Hong Kong's autonomy, adding: "We deplore this decision."
Taiwan even warned its citizens of risks in visiting Hong Kong.
Washington on Monday began moves to end Hong Kong's special status trade relationship with the US.
On Tuesday, China said it would respond to the removal with unspecified "countermeasures".
The UK earlier said it would change its immigration rules and offer millions of people in Hong Kong "a route to citizenship" if China went ahead with the legislation.