The legislation was unanimously approved by China's rubber-stamp parliament on Tuesday morning, little more than six weeks after it was first unveiled, sending shockwaves through semi-autonomous Hong Kong and beyond.
The United States, Britain, the European Union and the United Nations rights watchdog have all voiced fears the law could be used to stifle criticism of Beijing, which wields similar laws on the authoritarian mainland to crush dissent.
In an unprecedented decision, the law bypassed Hong Kong's fractious legislature and the wording was kept secret from the city's 7.5 million inhabitants.
"The national security law for Hong Kong was officially passed by the National People's Congress Standing Committee today," the DAB, Hong Kong's largest pro-Beijing party, said in a statement on Tuesday welcoming the law.
Wen Wei Po and Ta Kung Pao -- two Hong Kong newspapers that serve as conduits for Beijing's official policy -- also confirmed the passing of the law, as did multiple local Hong Kong media outlets citing anonymous sources in Beijing.
Even as word filtered out that the law had been approved, Hong Kongers remained in the dark about its contents and what might now constitute a crime.
At her weekly press conference on Tuesday morning, Hong Kong leader Carrie Lam -- a pro-Beijing appointee -- declined to comment on whether the law had been passed or what it contained.
"I think at this moment, it is not appropriate for me to comment on any questions related to the national security law," she told reporters.
'End of Hong Kong'
"So what on earth has been passed?" Figo Chan, a leader of the Civil Human Rights Group wrote on his Facebook page.
Prominent democracy campaigner Joshua Wong tweeted: "It marks the end of Hong Kong that the world knew before. With sweeping powers and ill-defined law, the city will turn into a #secretpolicestate."
In a largely symbolic move, the United States on Monday ended sensitive defence exports to Hong Kong over the law.
"We can no longer distinguish between the export of controlled items to Hong Kong or to mainland China," US Secretary of State Mike Pompeo said.
"We cannot risk these items falling into the hands of the People's Liberation Army, whose primary purpose is to uphold the dictatorship" of the Communist Party.
Hong Kong was guaranteed certain freedoms -- as well as judicial and legislative autonomy -- for 50 years in a deal known as "One Country, Two Systems".
The formula formed the bedrock of the city's transformation into a world class business hub, bolstered by a reliable judiciary and political freedoms unseen on the mainland.
Critics have long accused Beijing of chipping away at that status in recent years, but they describe the security law as the most brazen move yet.
A summary of the law published by the official state agency Xinhua earlier this month said China's security agencies would be able to set up shop publicly in the semi-autonomous city for the first time.
Beijing has also said it will have jurisdiction over some cases, toppling the legal firewall that has existed between Hong Kong and the mainland's party-controlled courts since the 1997 handover.
On the mainland, national security laws are routinely used to jail critics, especially for the vague offence of "subversion".
Beijing and Hong Kong's government reject those allegations.
They have said that the laws will only target a minority of people, will not harm political freedoms in the city and will restore business confidence after a year of historic pro-democracy protests.
Millions took the streets last year while a smaller hardcore of protesters frequently battled police in increasingly violent confrontations that saw more than 9,000 arrested.
The size, frequency and ferocity of the protests have dramatically declined in recent months with the pro-democracy movement hemmed in by the coronavirus outbreak, bans on public gatherings and aggressive policing tactics.