LONDON — Since becoming Britain’s prime minister six months ago, Boris Johnson has managed to strike a delicate balance in his relationship with President Trump, keeping him at a distance during Britain’s election while more recently showing sympathy for his pressure tactics against Iran.
On Tuesday, however, Mr. Johnson was confronted with a stark choice: In deciding to give the Chinese telecommunications giant, Huawei, limited access to Britain’s new high-speed broadband network, he broke abruptly with the president who once praised him as a “really good man” and a British version of himself.
That risks opening a rift between Mr. Johnson and Mr. Trump at the very moment Britain is leaving the European Union. It could also jeopardize efforts to negotiate a trans-Atlantic trade agreement that Mr. Johnson has promoted as one of the prizes of Britain’s newly independent status.
The Trump administration put heavy pressure on Mr. Johnson’s government to rule against Huawei, dispatching a high-level delegation to London two weeks ago to warn of the risks of opening up fifth-generation, or 5G, networks to a firm that they assert has ties to Chinese security agencies and the People’s Liberation Army.
But British officials said the American case was not persuasive, given Britain’s plan to limit the use of Huawei’s gear to what they characterize as “fringe” parts of the network. The drive to exclude the company, they said, appeared to come less from intelligence experts than from political appointees, who view Huawei in the context of curbing China’s global influence. Some said the heavy-handed approach backfired.
“You’ve had this crescendo of voices from Washington, trying with increasing stridency to put us off this decision,” said Peter Ricketts, a former British national security adviser and ambassador to France.
“It put the Boris Johnson government into a difficult position: did they defer to Trump’s view or did they defy it?” Mr. Ricketts said. “Anything other than approving it would have looked like caving into pressure.”
For Mr. Johnson, who spoke to Mr. Trump on Tuesday to brief him on the decision, there are political advantages to defying Washington. British leaders are regularly pilloried for playing the poodle to American presidents, and Mr. Johnson’s show of independence played well with British commentators.
“This decision is an important moment in the Johnson premiership,” said Malcolm Chalmers, the deputy director general of the Royal United Services Institute, a London-based research organization. “Even if you don’t agree with it, it shows a premier becoming ever more comfortable in his position.”
Experts said Mr. Johnson had calculated that however aggrieved Mr. Trump might be, the United States would not halt intelligence cooperation. The limitations on Huawei put in place by Britain’s security agencies, they said, should be sufficient to reassure the Americans that intelligence sharing channels would remain secure.
Mr. Trump himself has at times appeared more relaxed about Huawei. When he visited London last June, for example, he dismissed suggestions that the United States would halt intelligence-sharing if Britain did not bar the company.
“We are going to have absolutely an agreement on Huawei and everything else,” he said to then-Prime Minister Theresa May.
The impact of Mr. Johnson’s decision on the nascent trade negotiations with the United States was harder to predict. Three Republican senators — Marco Rubio of Florida, Tom Cotton of Arkansas and John Cornyn of Texas — wrote to members of Britain’s National Security Council, warning them that a decision to approve Huawei could threaten Congressional approval of a trade deal.
“Our special relationship is less special now that the U.K. has embraced the surveillance state commies at Huawei,” said Sen. Ben Sasse, a Republican from Nebraska and a prominent China hawk. “During the Cold War, Margaret Thatcher never contracted with the K.G.B. to save a few pennies.’’
The debate over Huawei divided Mr. Johnson’s cabinet and the Conservative Party. Critics warned that Britain’s plans to limit the use of the company’s gear were unrealistic and would leave it vulnerable to Chinese intelligence.
Tom Tugendhat, a Conservative member of Parliament who had urged Mr. Johnson to bar Huawei, said on Twitter that the plan “leaves many concerns and does not close the UK’s networks to a frequently malign international actor.”
To some extent, Mr. Johnson’s decision reflects a blunt assessment of Britain’s economic interests as it tries to chart a new future outside the European Union.
Brexit, Mr. Johnson argues, will give the country the freedom to enact its own regulations to encourage new technologies like artificial intelligence. The prime minister’s influential adviser, Dominic Cummings, has put particular emphasis on the need to invest in the technologies of the future.
Mr. Cummings wants to create a British version of the Defense Advanced Research Projects Agency in the United States, to make Britain “the best place in the world to be for those who can invent the future,” he wrote in a blog. For him, the 5G network is a critical part of that investment.
British officials said they were left with little choice but to approve Huawei because of the lack of alternative providers — Samsung is not a competitor in Britain, as it is in the United States — and the fact that Huawei is a well-established player in the British network, which means that if it barred the company, it would potentially have to rip Huawei gear out of the existing 4G network.
In the gesture to Washington, British officials said they hoped to reduce reliance on Huawei and other companies classified by the British government as “high risk,” by luring Samsung to invest and encouraging small new ventures.
British officials acknowledged that the Huawei decision comes on top of differences over policy toward Iran and over a digital services tax that would hit American technology giants like Google and Amazon.
British officials even worried that they might block Huawei, only to see a shift in policy from Mr. Trump back in its favor. The Chinese company is not completely locked out of the American market and could theoretically be given a bigger role as part of the second phase of Mr. Trump’s trade negotiations with China.
The same uncertainties plague a potential trans-Atlantic trade deal, given Britain’s need to negotiate a much bigger agreement with the European Union as well as the presidential election in the United States.
Moreover, compared to the potential of 5G, the gains from a trade deal look paltry. In 2018, the last time the British government estimated the economic effects of Brexit, it projected that new trade agreements with the United States — as well as with Australia, New Zealand and a host of other countries — would collectively yield a gain of just 0.2 percent of gross domestic product by 2035.
To strike a trade agreement with the United States, Britain would also likely have to make politically unpopular concessions. The Trump administration would probably demand opening the British market to farm products like chlorinated chicken and hormone-fed beef and removing restrictions on what drug companies can charge the National Health Service for their products.
“The government took a risk assessment of both Huawei and the American reaction,” Mr. Ricketts said, “and decided to press ahead.”