As part of the 1997 handover from Britain, China agreed to guarantee Hong Kong certain freedoms -- as well as judicial and legislative autonomy -- for 50 years in a deal known as "One Country, Two Systems".
Beijing says that promise is still being respected even after Tuesday's move to impose a secretive national security law on the restless city.Critics, rights groups and some Western nations say the legislation is just the latest step by China to chip away at the city's civil liberties over the years.
Here is a timeline of how that tension has unfolded:
- 2003: First security law attempt
The first major protests to hit Hong Kong after the handover were sparked by the local government's attempt to pass a national security law.
Article 23 of the Basic Law -- Hong Kong's mini constitution -- says the city must create a law prohibiting "treason, secession, sedition (and) subversion".
But the law was never implemented due to public fears it would curtail the city's similarly constitutionally guaranteed free speech laws.Half a million took to the streets. The bill was shelved and then city leader Tung Chee-hwa eventually stepped down.
- 2012: Education reform
A period of comparative political calm followed.
But in 2012, an attempt to usher in more patriotic classes sparked student protests.
Led by then 15-year-old activist Joshua Wong, tens of thousands of students, parents and teachers rallied against the plan which was eventually scrapped.
- 2014: No universal suffrage
Article 45 of Hong Kong's Basic Law stipulates that the "ultimate aim" is for the city's leader to be selected by "universal suffrage".
But this promise has never been fulfilled.
In 2014, Beijing offered its version of universal suffrage -- Hong Kongers would be able to choose from a small group of pre-vetted candidates.
The announcement sparked a 79-day occupation of major thoroughfares known as the "Umbrella Movement".
- 2015: Disappearing booksellers
Under "One Country, Two Systems" Hong Kong polices itself.
But the disappearance into mainland custody of five people working for a bookstore publishing salacious titles about China's leaders ignited fears Beijing's security services had abandoned that principle.
The booksellers later appeared on TV in mainland China admitting to a variety of crimes.
A billionaire businessman also disappeared in 2016, and later surfaced in mainland custody charged with corruption.
- 2016/17: Lawmakers disqualified -
Between 2016 and 2017, it became clear certain political views would no longer be allowed.
Two pro-independence and four pro-democracy lawmakers were disqualified from Hong Kong's legislature for changing their oaths of office to protest Chinese rule.
In a rare interpretation of the Basic Law, Beijing said any oath taker who was not "sincere and solemn" manner should be disqualified.
- 2019: Extradition bill
In 2019, the Hong Kong government tried to fast-track a bill through the city's partially elected legislature that would have allowed extraditions to China's Communist Party-controlled courts.
The move sparked the biggest protests Hong Kong had witnessed since the handover.
Millions took to the streets during seven months of unrest while a smaller section of hardcore protesters frequently battled police in often-violent confrontations that saw more than 9,000 arrested.
The movement soon morphed into a new call for democracy and police accountability.
- 2020: National security law -
In a bid to quell protests, Beijing passed a national security law for Hong Kong on Tuesday in an unusually speedy and opaque process.
The law bypassed Hong Kong's legislature entirely. The city's 7.5 million inhabitants were not shown details of the law even as it was passed.
A summary published by China's official Xinhua news agency Xinhua this month said the legislation would cover subversion, secession, terrorism and colluding with foreign forces.
China's security agencies will be able to set up shop publicly in the city for the first time.
And Beijing will have jurisdiction over some cases, toppling the legal firewall that has existed between Hong Kong and mainland courts.