China has passed a controversial security law giving it new powers over Hong Kong, deepening fears for the city's freedoms, the BBC has learned.
Last month China stunned the city when it said it would criminalise any act of secession, subversion, terrorism or collusion with foreign forces.
The move came after angry protests last year - sparked by another law - which became a pro-democracy movement.
Critics say this new law poses an even greater threat to Hong Kong's identity.
They warn it will undermine Hong Kong's judicial independence and destroy the city's unique freedoms, not seen on mainland China.
Hong Kong was handed back to China from British control in 1997, but under a special agreement that guaranteed certain rights for 50 years.
So the law has drawn harsh international condemnation and also sparked demonstrations in Hong Kong ever since it was announced by Beijing in May.
A draft of the law was not made public before it was pushed through, which means most people in the city will not have seen details of the measures they now have to abide by.
China says the law is needed to tackle unrest and instability in the city and rejects criticism as interference in its affairs.Image copyright AFP Image caption Critics warn the law will shut down dissent
What does the new law do?
China has not officially confirmed the law has been passed, but the BBC has been told that it went through unanimously in a session of the Standing Committee of the National People's Congress in Beijing.
It is expected to be added to Hong Kong's Basic Law later in the day and comes a day before the 23rd anniversary of the handover from Britain to China - a date usually marked by pro-democracy protests.
It would make criminal any act of secession, subversion of the central government, terrorism and collusion with foreign or external forces.
A new national security 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.Image copyright Getty Images Image caption The bill will cement Beijing's control of Hong Kong
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 very nature of the law undermines the freedoms that set Hong Kong apart from the rest of China - and helped defined the character of the city.
People in Hong Kong prized civil liberties such as free speech, the right to protest and an entirely independent and robust judiciary.
Critics say that in effect this law could silence dissent and will extend the influence of the Chinese Communist Party over more aspects of Hong Kong life.
Hong Kong's Chief Executive Carrie Lam has previously dismissed such fears, saying this was a "responsible" move to protect the law-abiding majority.
She has said that Hong Kong's freedoms, vibrancy and core values will be preserved.
What has the reaction been?
One of the city's most prominent activists, Joshua Wong, on Tuesday said he would quit the pro-democracy group Demosisto he spearheaded until now. Fellow activists Nathan Law and Agnes Chow joined him.
Rights group Amnesty International said the law was "a weapon of repression to be used against government critics" and describes it as "the greatest threat to human rights in the city's recent history".
Taiwan on Tuesday warned its citizens of risks in visiting Hong Kong, saying the new law would "severely impact" freedom, democracy and human rights in Hong Kong.
Media playback is unsupported on your device
There was widespread international criticism even before the law was passed.
Washington has threatened to end Hong Kong's special status trade relationship while the European Parliament voted to take China to the International Court of Justice in The Hague should the law be imposed.
The UK 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.
Earlier in June, all members of the G7 had signed a statement asking Beijing to reconsider the planned bill.
Why is China imposing the law?
The 1997 handover agreement between the UK and China - a mini-constitution called the Basic Law and a so-called "one country, two systems" principle - envisages Hong Kong rights that include freedom of assembly and speech, an independent judiciary and some democratic rights which no other part of mainland China has.
Under the same agreement, Hong Kong was expected to enact its own national security law - this was set out in Article 23 of the Basic Law.
But its unpopularity means it has never been done - the government tried in 2003 but had to back down after protests.
In recent years, Hong Kong has repeatedly seen waves of protests against Beijing's influence and demanding more rights.
Then, in 2019, protests over an extradition law turned violent and evolved into a broad anti-China and pro-democracy movement.