BEIJING -- China's legislature endorsed a national security law for Hong Kong on Thursday that has strained relations with the United States and Britain and prompted new protests in the territory.

The National People's Congress approved the bill as it wrapped up an annual session that was held under intensive anti-coronavirus controls. The vote was 2,878-1 with six abstentions, in line with the high-profile but largely ceremonial body's custom of near-unanimous support for all legal changes decided by the ruling Communist Party.

The law will alter Hong Kong's mini-constitution, or Basic Law, to require the territory to enforce measures to be decided by the NPC's standing committee, a small body controlled by the ruling party that handles most lawmaking work.

The law reflects the determination of President Xi Jinping's government to tighten control over Hong Kong following 11 months of anti-government protests. Activists in Hong Kong say the law will undermine the "high degree of autonomy" promised to the former British colony when it was handed back to China in 1997 under a "one country, two systems" framework and might be used to suppress political activity.

Premier Li Keqiang, the country's No. 2 leader, defended the law as consistent with Beijing's promises.

"The decision adopted by the NPC session is designed for steady implementation of `one country, two systems' and Hong Kong's long-term prosperity and stability," Li said at a news conference.

The law and the way it is being enacted prompted U.S. Secretary of State Mike Pompeo on Wednesday to announce Washington will no longer treat Hong Kong as autonomous from Beijing. That could hurt the territory's attractiveness as a business centre.

Pompeo's notice adds Hong Kong to the Trump administration's conflicts with China over trade, technology, religious freedom, Chinese handling of the coronavirus pandemic and the status of Taiwan, the self-ruled island Beijing claims as its own territory.

Li called for mutual respect and Sino-U.S. co-operation to promote "extensive common interests" in resolving global problems and promoting trade, science and other fields.

"Both countries stand to gain from co-operation and lose from confrontation," Li said.

On Thursday, three pro-democracy lawmakers were ejected from Hong Kong's legislative chamber during a debate over a bill that would criminalize insulting or abusing the Chinese national anthem.

Also Thursday, the NPC approved a government budget that will increase spending to generate jobs to try to reverse an economic slump after Chinese industries were shut down to fight the coronavirus pandemic.

Private sector analysts say as much as 30% of the urban workforce, or as many as 130 million people, lost their jobs at least temporarily during the shutdown. They say as many as 25 million jobs might be lost for good this year.

The budget calls for giving local governments 2 trillion yuan ($280 billion) to spend on meeting goals including creating 9 million new jobs. That is in line with expectations of higher spending but a fraction of the $1 trillion-plus stimulus packages launched or discussed by the United States, Japan and Europe.

Li, the premier, said Beijing is in a "strong position to introduce new measures" if necessary but wants to avoid flooding the economy with too much money. He said 70% of planned spending is aimed at putting wages in workers' pockets in order to support consumer spending, the biggest driver of the economy.

"We will do our utmost to keep China's economic growth stable," Li said. "At the same time, we must make sure that all measures taken are well calibrated."

In an anti-virus measure, Li sat on a dais in the Great Hall of the People, the seat of the legislature in central Beijing, and talked by video link with reporters at a media centre 4 miles (6.5 kilometres) away. The reporters, wearing masks, sat in widely spaced chairs in an auditorium, watching Li on a video screen.

He called for international co-operation in fighting the coronavirus pandemic but didn't answer a question about how an investigation into the origins of the pandemic demanded by Washington and some other governments should be conducted.

Beijing has resisted pressure for an inquiry following criticism it mishandled the early response to the disease that emerged in central China in December. China has blocked beef imports from four Australian suppliers in apparent retaliation for Australia's calls for an investigation.