China on Tuesday enacted a controversial national security law to crack down on what Beijing views as subversive activity in Hong Kong, the state-run Xinhua News Agency reported, a move that could jeopardize human rights and freedoms in the former British colony.

The passage of the bill came a day ahead of the 23rd anniversary of Hong Kong's return to Chinese sovereignty when protesters might stage their annual march to mark the day despite an official ban on it due to the coronavirus pandemic.

The legislation, which was approved at the Standing Committee of the National People's Congress, China's parliament, is partially aimed at quelling protest against the pro-Beijing government in the special administrative region.

The Chinese Communist Party's latest action is sure to antagonize pro-democracy protesters in the territory and draw international condemnation, while Beijing claims the Hong Kong issue is an "internal affair" and should not be "interfered with by external forces."

All 162 members of the committee voted in favor of the bill. Chinese President Xi Jinping, who heads the ruling party, signed a presidential order to promulgate the law, and it became effective in Hong Kong on Tuesday night.

Some observers regard the law as being tied to Beijing's efforts to prevent pro-democracy forces from gaining a majority for the first time in the local legislature in the September election after they scored a landslide victory in November's district council elections.

In Hong Kong, Joshua Wong, who led the 2014 "Umbrella Movement," and other prominent pro-democracy activists quit their political group Demosisto on Tuesday, indicating the new law would continue to intimidate protesters against the mainland government down the road.

A man holds up an anti-national security law placard during a protest against the national security law on June 28, 2020 in Hong Kong, China.

On Monday, the United States, which China alleges supports Hong Kong's independence, began revoking the special treatment extended by law to the territory, fanning fears that already strained Sino-U.S. relations will deteriorate further.

Britain, along with Australia, Canada and the United States, has also released a joint statement calling on China to work with the Hong Kong government and people to reach "a mutually acceptable accommodation that will honor China's international obligations."

President Tsai Ing-wen of Taiwan, which Beijing sees as a renegade province awaiting reunification, lambasted China on Tuesday for having broken its commitment to leaving Hong Kong's own legal and economic systems intact for a half-century.

Under Beijing's "one country, two systems" policy, Hong Kong was promised it would enjoy the rights and freedoms of a semiautonomous region for 50 years following the former British colony's return to Chinese rule in 1997.

In line with the framework, the United States, under a 1992 law, has given Hong Kong special treatment separate from the rest of China on matters such as tariffs and visa issuance.

The situation has been seen as fundamental to Hong Kong's role as an attractive investment destination and global financial hub. But the U.S. decision could deprive Hong Kong of such status, in turn eroding direct investment to China.

Hong Kong leader Carrie Lam, however, said at a meeting on Tuesday that any sanctions by foreign governments "will not scare" the territory, vowing to deepen cooperation with Beijing.

The U.S. State Department pledged Monday to end controlled defense exports to Hong Kong and to take steps to impose the same restrictions on the transfer of U.S. defense and dual-use technologies to the region as it puts on mainland China.

Secretary of State Mike Pompeo said in a statement, "Beijing now treats Hong Kong as 'one country, one system,'" so Washington has been forced to implement measures to "protect U.S. national security."

At a press briefing in Beijing, Foreign Ministry spokesman Zhao Lijian said China will retaliate against the United States in response to the "wrong action" by Washington.

Japan, which has built close economic ties with Hong Kong for decades, called China's enactment of the national security law "regrettable," saying it will hurt international confidence in the "one country, two systems" principle.

Chief Cabinet Secretary Yoshihide Suga, the top government spokesman, told reporters in Tokyo that it is important for Hong Kong to maintain its free and open system so that it can prosper in a "democratic and stable way."

According to the details of the law run by Xinhua, the central government in Beijing sets up an office in Hong Kong to collect intelligence and safeguard security and order in the territory.

The Hong Kong government establishes a national security committee headed by its chief executive and the central government appoints and dispatches advisers to it, in an apparent attempt to tighten its grip on the city.

Those who commit major crimes including terrorism are punishable with up to a life sentence.

Foreign affairs experts warn the legislation would allow China to level charges of sedition at people in Hong Kong who criticize Beijing.

In Hong Kong, large-scale demonstrations sparked by a now-withdrawn extradition bill with mainland China morphed into an anti-government movement last year, with protesters seeking a probe into police use of force.

In late May, the national parliament passed a resolution regarding the introduction of the national security law for Hong Kong, saying the legal reforms are needed for the territory's "long-term stability and prosperity."

The standing committee is usually held once every two months but took place twice in June. Although China's law stipulates that a public comment period is set, it was not done during the statutory process of the security legislation for Hong Kong.

Pro-democracy activists and lawyers in the region have argued that the mainland's deliberations on the bill were opaque and sloppy.

Related coverage:

Japan warns China's move on H.K. law would affect Xi's visit

Hong Kong activists quit political group as China enacts security law

U.S. starts revoking Hong Kong privileges to pressure China