HONG KONG — British Prime Minister Boris Johnson pledged Wednesday to overhaul immigration rules to grant almost 3 million Hong Kong residents a pathway to British citizenship, a response to Beijing's move to impose a far-reaching security law here that many fear will dismantle the city's political freedoms.

Johnson's vow comes as the United States, Canada, Australia and others face pressure from lawmakers and human rights groups to offer residency to Hong Kong people fleeing deteriorating political circumstances in the former British colony, which was promised a high degree of autonomy under the terms of its 1997 handover to China.

London’s move, which Johnson said he would implement when China formally enacts the security law, could emerge as among the most significant ramifications of Beijing’s effort to undercut Hong Kong’s freedoms and bring the city more closely under the Communist Party’s authoritarian rule. It would potentially grant British residency and working rights to up to 40 percent of Hong Kong’s population, raising the specter of a brain drain from the Asian financial center.

In op-eds published in the South China Morning Post and the Times of London, Johnson said the Chinese security law — which will criminalize broadly worded offenses such as sedition, subversion and foreign interference — gives Britain “no choice but to uphold our profound ties of history and friendship with the people of Hong Kong.”

Specifics of the new law are scant, but the approved proposal will allow Chinese security forces to operate in Hong Kong for the first time, enabling them to crush dissent as they do on the Chinese mainland. Hong Kong has been rocked in recent times by widespread protests calling for greater democracy and opposing Beijing’s tightening grip.

Johnson wrote that his government would allow holders of British National (Overseas), or BNO, passports to come to Britain for a renewable period of 12 months and gain the right to work. The move “could place them on a route to citizenship,” he said.

These passports, a holdover from British rule issued to people born before 1997, currently allow holders to stay in Britain for six months but do not afford work rights or residency. About 350,000 people in Hong Kong hold these documents, but an additional 2.5 million are eligible.

China’s Foreign Ministry said Wednesday that Britain has no jurisdiction over Hong Kong. Britain must “step back from the brink” and “stop interfering in Hong Kong’s affairs and China’s internal affairs,” spokesman Zhao Lijian told reporters.

As the former colonial ruler, London was a signatory to the Sino-British Joint Declaration in which China agreed to preserve Hong Kong’s political freedoms and way of life until 2047.

Hong Kong’s government declined to comment Wednesday and referred The Washington Post to statements by China’s Foreign Ministry.

Lawmakers in other Western countries have issued similar calls to offer refuge to people fleeing the crackdown in Hong Kong, although the BNO passports give Britain a relatively easy route to welcome residents of the territory. This week, Senate Majority Leader Mitch McConnell (R-Ky.) said the U.S. response should “mirror those of other democracies who have opened their doors to Hong Kongers fleeing oppression.”

“Our nation has a rich heritage of standing as a beacon of light and freedom, from refugees of war to those escaping the Iron Curtain,” he said. “We should exercise it again for the people of Hong Kong.”

President Tsai Ing-wen of Taiwan has said her government is also working on measures to allow Hong Kongers to move to the self-governed democracy to live and work.

Hong Kong protesters have repeatedly demonstrated outside the British Consulate and have pressed the British government to allow BNO passport holders a pathway to full citizenship. Since China announced it was imposing the security law by fiat, bypassing Hong Kong’s legislature, dozens have flocked to renew those documents, local media reported.

Rana Mitter, director of the University of Oxford’s China Center, said Johnson’s move underscores the “very significant turn — not 180 degrees, but let’s say 90 degrees” — over recent months in the British government’s approach to China. He said that for Britain, “it’s becoming clearer that on certain issues, including maintenance of guarantees under the joint agreement on Hong Kong, it is not willing to be silent.”

By offering a path to citizenship for a significant number of people, the Johnson government can send a strong signal after Brexit that its departure from the European Union was “not purely about drawing up the immigration drawbridge,” Mitter said.

There has long been a strong sentiment in sections of Britain’s ruling Conservative Party that the country did not do enough for Hong Kong during the handover and that they want to do more now.

A YouGov poll conducted last week found that more Britons support than oppose giving BNO passport holders greater rights to live and work in Britain. About one-third were undecided.

Still, some in Hong Kong expressed skepticism about leaving, daunted by the prospect of navigating life in the United Kingdom.

“The unemployment rate in the U.K. is high,” said Ken Chong, a 30-year-old BNO passport holder who works at a bank in Hong Kong. “I’m not sure it will make a big difference for BNO holders, but as long as they are pressuring the Chinese government, then that’s a good move.”

Wayne Ma, a social media editor in Hong Kong, said he would not consider moving to Britain, because he could not afford to live there.

“I wouldn’t count on Britain to save Hong Kong,” he said. “I think it is unable to even fend for itself.”

Karla Adam in London and Tiffany Liang in Hong Kong contributed to this report.