(CNN) On June 30, China passed a controversial national security law for Hong Kong that lends Beijing sweeping new powers over the semi-autonomous city.
Critics say the law, which wasn't revealed to the public until after it was passed, marks an erosion of the city's precious civil and political freedoms; the Chinese and local governments argue it's necessary to curb unrest and uphold mainland sovereignty.
Here's what you need to know about the law -- and what it means for the city.
Beijing has been asking Hong Kong to pass a national security law since 1997, when the former British colony was handed back to China. There's even an article in the city's mini-constitution calling on it to do so.
Hong Kong politicians have attempted to pass the legislation before, but faced fierce public opposition.
On May 22, Beijing took matters into its own hands and proposed the bill for Hong Kong at the National People's Congress (NPC), China's rubber-stamp parliament.
While Hong Kong has an independent legal system, a back door in its mini-constitution allows Beijing to make law in the city -- meaning there wasn't much the Hong Kong public or leadership could do about it.
The four crimes laid out in the law are secession, subversion against the central Chinese government, terrorist activities, and collusion with foreign forces to endanger national security.
The law allows mainland Chinese officials to operate in Hong Kong for the first time, gives Beijing the power to override local laws and impacts broad swathes of Hong Kong society -- as well as foreign nationals overseas.
The crimes are vaguely defined and wide-ranging; for instance, it's now a crime to work with a foreign government or organization to incite "hatred" toward the central Chinese government.
Calling for Hong Kong independence now counts as a crime under "secession," and vandalizing public property or government premises -- like protesters did for months last year -- are now considered terrorist activities.
People face a maximum penalty of life imprisonment for all four crimes.
Under the law:
The law includes various other elements, including the introduction of "national security education" in schools, stronger government "management" of foreign news media and NGOs, greater wiretapping abilities for police, and more.
The local government tried to pass a national security law in 2003, but after massive protests, they shelved the legislation and no administration has dared to try again, much to China's frustration.
Hong Kongers back then had the same fears as they do now -- that a national security law could infringe on their freedoms and be used to crush dissent.
Then the 2019 protests happened, this time against another bill that would have allowed suspects in Hong Kong to be extradited to the mainland. Many Hong Kongers once again feared that Beijing was extending its reach into the city's independent judicial system.
For more than six months, Hong Kong was rocked by often violent pro-democracy, anti-government protests, which posed a major challenge to the city's local leaders and police force, who deployed tear gas and water cannon.
Beijing's patience, long frayed by the local government's failure to pass the law, ran out -- so the central government took action into its own hands.
Though Hong Kong is part of China, it enjoys more liberties than any other Chinese city.
Hong Kong was a British territory until it was handed back to China in 1997. The handover agreement gave the city special freedoms of press, speech, and assembly, protected for at least 50 years, in a model of governance called "one country, two systems."
Under this model, Hong Kong also has its own currency, judicial system, identity and culture -- freedoms that stand in stark contrast to China's censorship and authoritarian rule in the mainland.
Hong Kongers have long feared Chinese encroachment on their autonomy, and have pushed for greater democracy -- one of the driving factors behind last year's protests, as well as the 2014 Umbrella Movement.
The law drastically broadens Beijing's power over Hong Kong and has potentially massive ramifications for the city's political freedoms.
Many worry the law could be used to target dissidents, a fear that stems from China's judicial track record.
In the mainland, national security laws have been used to prosecute pro-democracy campaigners, human rights activists, lawyers and journalists. Arbitrary punishments and secret detentions are almost unheard of in Hong Kong -- but people worry this new law could change that.
Critics say the law could also cause increasing self-censorship in the media, the exclusion of pro-democracy figures from the city's legislature, and threaten Hong Kong's reputation as a safe base for international businesses.
After the law was published, critics pointed to elements like mainland jurisdiction on cases as violating "one country, two systems" and the freedoms Hong Kong had been promised.
China's announcement of the law was met with fierce resistance from parts of Hong Kong society. After the proposal was announced in May, crowds of protesters returned to the streets and clashed with police, who again fired tear gas and deployed water cannon.
Activists also vowed to demonstrate against the law on July 1 -- traditionally a day of protests in the city. However, for the first time since handover, police have not given permission to protesters to hold peaceful demonstrations. Crowds did take to the streets, however, but were a fraction of numbers seen in recent years.
Pro-democracy lawmakers including Claudia Mo condemned the law as "taking away all the core values we've come to know," while the Hong Kong Bar Association blasted the law as a major blow to judicial independence.
Some Hong Kongers have told CNN they are considering fleeing the city to safer shores like the self-governing island of Taiwan, where authorities set up an office to help Hong Kong citizens moving there for "political reasons."
After the law passed, major pro-democracy figures and activists like Joshua Wong withdrew from the political party Demosisto, which announced just hours afterward that it was disbanding. Wong called it "a harsh fate," and urged action from the international community.
But some have also welcomed the law. Business officials have argued it could bring much-needed stability to the city after last year's unrest, which devastated the city's economy, shuttered scores of stores and restaurants, and damaged Hong Kong's international reputation. HSBC and Standard Chartered, two of Hong Kong's biggest banks, both support the bill.
During the drafting process, Lam, Hong Kong's leader, said the central government had "no alternative but to take action" after last year's political unrest, and that Hong Kong had a "constitutional duty" to uphold China's sovereignty.
She has repeatedly denied the law will infringe on citizens' basic rights, stating that it will not undermine the city's "judiciary independence and high degree of autonomy."
On July 1, the day after the law passed, she called it "a historical step" and "the most significant development in the relationship between the Central Authorities and the HKSAR since Hong Kong's return to the motherland."
Chief Secretary Matthew Cheung, Hong Kong's second-highest ranking official, also insisted in June that only terrorists and separatists will be targeted by the law -- but he had little influence in the drafting the details.
Hong Kong Police Commissioner Chris Tang told Chinese state broadcaster CCTV in May that the law "will not affect Hong Kong people's rights and freedom" and will help the city "become more stable and safe."
In the month leading up the the law's passage, international leaders, lawmakers, and activists voiced their concern and condemnation.
Days before the law passed, US Secretary of State Mike Pompeo announced new visa restrictions on current and former Chinese officials who "were responsible for eviscerating Hong Kong's freedoms."
US President Donald Trump has also blasted Beijing for the law, and revoked Hong Kong's special status on trade in May. Other US senators and leaders, like House Speaker Nancy Pelosi, expressed criticism and outrage after the law passed.
In June, UK Prime Minister Boris Johnson argued the law "would curtail (Hong Kong's) freedoms and dramatically erode its autonomy," and promised to provide a path to British citizenship for potentially millions of Hong Kongers.
After the law passed, British Foreign Secretary Dominic Raab tweeted that China had "chosen to break their promises to the people of Hong Kong and go against their obligations to the international community."
The leaders of the European Union (EU) expressed "grave concerns" about the potential threat to fundamental rights and freedoms. Lawmakers in the European Parliament warned that China was violating its international commitments, and proposed bringing China before the International Court of Justice.