China imposed a sweeping national security law on Hong Kong Tuesday, dramatically tightening its grip on the semi-autonomous city in a historic move decried by Western nations as a threat to the financial hub's freedoms. Described by Beijing as a "sword" hanging over the heads of those endangering national security, the law took effect hours after it was signed by President Xi Jinping and just six weeks since it was first unveiled. Fed up with pro-democracy protests that rocked the city last year, China's top lawmaking body enacted the legislation following closed-door deliberations that kept details secret until its passage. The law gives Beijing jurisdiction over "very serious" national security crimes, with offenders facing up to life in prison, according to the text published late Tuesday. The controversial law also empowers China to set up a national security agency in the city, staffed by officials who are not bound by local law when carrying out duties. The new suite of powers radically restructures the relationship between Beijing and Hong Kong, toppling the legal firewall that has existed between the city's independent judiciary and the mainland's party-controlled courts. "It marks the end of Hong Kong that the world knew before," prominent democracy campaigner Joshua Wong tweeted as his political party Demosisto announced it was disbanding. "With sweeping powers and ill-defined law, the city will turn into a #secretpolicestate." Some Hong Kongers responded by deleting Twitter accounts and scrubbing other social media platforms. In contrast, former city leader Leung Chun-ying took to Facebook to offer bounties of up to HK$1 million ($130,000) for anyone who could help secure the first prosecutions under the new legislation or track down people who have recently fled the city. Twenty-seven countries, including Britain, France, Germany and Japan, urged Beijing to "reconsider the imposition" of the legislation, saying in a statement to the UN Human Rights Council that it "undermines" the city's freedoms. The move has also added fuel to tensions between Beijing and Washington, where condemnation of the move crossed the aisle. Top Democrat Nancy Pelosi said its "brutal purpose" was to "frighten, intimidate & suppress the speech of Hong Kongers," and Republican Mitt Romney tweeted that his "heart aches for the people of Hong Kong. Any semblance of freedom and autonomy has vanished." - 'Fundamental change' - As part of the 1997 handover from Britain, 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 helped to cement the city's status as 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, but they describe the new security law as the most brazen move yet. British Prime Minister Boris Johnson said he was "deeply concerned" and that London would scrutinise the law "to understand whether it is in conflict" with the handover agreement. The law bans four types of national security crimes: subversion, secession, terrorism and colluding with foreign forces to endanger national security. The text gave three scenarios in which China might take over a prosecution -- complicated foreign interference cases, "very serious" cases and when national security faces "serious and realistic threats." Cases can be passed to mainland China, with the Supreme People's Procuratorate and the Supreme Court designating the judicial authorities handling them. Lead perpetrators and serious offenders can receive 10 years to life in prison for engaging in one of the national security crimes. The law also said certain national security cases could be held behind closed doors without juries in Hong Kong if they contained state secrets, although the verdict and eventual judgments would be made public. "It's a fundamental change that dramatically undermines both the local and international community's confidence towards Hong Kong's 'One Country, Two Systems' model and its status as a robust financial centre," Hong Kong political analyst Dixon Sing told AFP. - Restore stability - 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 the law 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. "I urge the international community to respect our country's right to safeguard national security and Hong Kong people's aspirations for stability and harmony," Hong Kong city leader Carrie Lam told the UN Human Rights Council in a video message on Tuesday. Millions took to the streets last year, while a hard core of protesters frequently battled police in often violent confrontations that saw more than 9,000 arrested. Hong Kong has banned protests in recent months, citing previous unrest and the coronavirus pandemic, although local transmissions have ended. Some Western nations warned of potential repercussions ahead of the security law's passing. However, many are also wary of incurring Beijing's wrath and losing lucrative access to the mainland's huge economy. "We deplore this decision," said European Council head Charles Michel. Washington -- which has embarked on a trade war with China -- has said the security law means Hong Kong no longer enjoys sufficient autonomy from the mainland to justify special status. The United States on Monday ended sensitive defence exports to Hong Kong over the law, prompting China to threaten unspecified "countermeasures."