By Keith Bradsher, New York Times–

China officially has the broad power to quash unrest in Hong Kong, as the country’s legislature on Thursday nearly unanimously approved a plan to suppress subversion, secession, terrorism and seemingly any acts that might threaten national security in the semiautonomous city.

As Beijing hashes out the specifics of the national security legislation in the coming weeks, the final rules will help determine the fate of Hong Kong, including how much of the city’s autonomy will be preserved or how much Beijing will tighten its grip.

Early signals from Chinese authorities point to a crackdown once the law takes effect, which is expected by September.

Activist groups could be banned. Courts could impose long jail sentences for national security violations. China’s feared security agencies could operate openly in the city.

Even Hong Kong’s chief executive this week appeared to hint that certain civil liberties might not be an enduring feature of Hong Kong life. “We are a very free society, so for the time being, people have the freedom to say whatever they want to say,” said the chief executive, Carrie Lam, noting, “Rights and freedoms are not absolute.”

The prospect of a national security law has prompted an immediate pushback in Hong Kong, where protesters are once again taking to the streets. The international community, too, has warned against infringing on the city’s civil liberties.

The Trump administration signaled Wednesday that it was likely to end some or all of the U.S. government’s special trade and economic relations with Hong Kong because of China’s move. The State Department no longer considers Hong Kong to have significant autonomy, Secretary of State Mike Pompeo said, a condition for maintaining the trade status.

China’s premier, Li Keqiang, tried to strike an optimistic note about the national security law, saying on Thursday that it would provide for the “steady implementation of the ‘one country, two systems’” political framework that has enshrined Hong Kong’s relative autonomy since the territory was reclaimed by China in 1997. The rules, the premier said at the conclusion of the annual session of the legislature, the National People’s Congress, would protect “Hong Kong’s long-term prosperity and stability.”

Clues on the coming security law can be found in earlier templates: a 2003 bill in Hong Kong that was thwarted by protests, and a law in another semiautonomous Chinese city, Macau.

Both contained broadly worded bans on sedition, subversion, secession and treason, while also enhancing law enforcement powers. The Hong Kong legislation would have allowed raids without warrants if the police believed national security would be jeopardized by waiting for a judge — the prospect of which drew vast crowds of peaceful protesters.

Both bills also made it easier for the authorities to win national security cases in court. The Macau legislation, for example, bars judges with foreign citizenship from serving on panels hearing national security cases. Hong Kong’s courts have long relied heavily on judges who have moved to the city from the British Commonwealth but retain passports from their home countries.

The legislation in Macau, a former Portuguese colony, has gone essentially unused for the past 11 years since its passage. The authorities there have preferred to takemeasures against occasional protests under statutes that attract less attention. But Macau’s government, unlike Hong Kong’s, has not faced a broad-based democracy movement that has attracted international sympathy.

Hong Kong’s political framework doesn’t offer much relief from the new law. The framework, specified in the city’s Basic Law and the Bill of Rights, provides broad protections for civil liberties. But a big exemption exists for the sort of national security legislation that Beijing is now drafting.

Both pieces of the framework draw on the language in the United Nations’ International Covenant on Civil and Political Rights. The covenant has six different clauses allowing rights to be restricted if national security is at risk.

“If you do not plan to engage in acts of secession, subversion, terrorism or conspiring with foreign influence in connection with Hong Kong affairs, you will have no reason to fear,” Tung Chee-hwa, who was the city’s chief executive at the time of the 2003 national legislation, said on Monday.

The process for drafting and enacting the new law is prompting concerns.

The Standing Committee of China’s legislature is writing the new rules on its own, without consulting Hong Kong experts. Once the legislation is written, the Beijing-appointed leadership of Hong Kong is required to put it into law immediately.

“Since this is the legislative work of the Central Government, I am afraid that there will be no public consultation in Hong Kong,” Mrs. Lam said on Tuesday.

Some pro-democracy lawyers have questioned whether Beijing’s process for issuing the law is constitutional. But Hong Kong designates the Chinese government as the final arbiter on constitutional questions in the territory.

The current plan for national security laws is considerably broader than the 2003 bill. For starters, it calls for a ban on terrorism.

Chinese officials have given no hint of how terrorism will be defined. But the same committee that will draft the Hong Kong rules issued antiterrorism laws in mainland China four years ago with very broad prohibitions.

Amendments in late 2015 to the mainland’s criminal law provisions regarding terrorism include long jail sentences for “whoever propagates terrorism or extremism by way of preparing or distributing books, audio and video materials or other items that propagate terrorism or extremism or by way of teaching or releasing information.”

The latest national security plan also widens the definition of subversion.

The 2003 bill was aimed at subversion against the “Central People’s Government.” That would have included government agencies under China’s cabinet, known as the State Council, said Albert Chen, a Hong Kong University law professor who advises Beijing on constitutional issues. But it is less clear whether it would have encompassed acts against the Chinese Communist Party.

By contrast, the new plan might, because it prohibits actions against “state power.” That term may include the leadership of the Chinese Communist Party, Mr. Chen said, noting that the leadership is enshrined in the Constitution.

Tens of thousands of people, and sometimes hundreds of thousands, gather each year at Victoria Park on June 4 to commemorate those who died in the Tiananmen Square crackdown in 1989. They often shout slogans against the Communist Party.

a group of people sitting around a bag of luggage: An anti-government demonstrator is detained by riot police during a lunch time protest as a second reading of a controversial national anthem law takes place in Hong Kong, May 27. REUTERS/Tyrone Siu

Phtoo gallery by Reuters

Lau Siu-kai, a former senior Hong Kong government official who now advises Beijing, said that the new legislation might not ban such speech. But it would likely bar activities that were organized by “anti-Beijing political groups.” Hong Kong already has a law blocking groups that advocate independence.

Thursday’s resolution calls for the drafting of legislation allowing mainland Chinese security agencies to operate “as necessary” in Hong Kong. Mr. Lau said that this meant the Ministry of Public Security, China’s main police and border control agency, and the Ministry of State Security, China’s main spy agency, would be allowed to open offices in Hong Kong to conduct investigations and gather intelligence.

But Beijing will still rely on the Hong Kong police and prosecutors to make arrests and charge offenders, he said. Mrs. Lam said that the Hong Kong police would remain “primarily” responsible for law enforcement.

The wild card in the new rules could be international pushback.

Mr. Lau said that if the United States took strong action, it would only reinforce Beijing’s concerns that foreign powers were using the city to undermine China’s national security. American measures may prompt the Standing Committee to write even more stringent legislation this summer, he added.

“If they push hard,” Mr. Lau said, “it may change for the worse rather than the better.”