UK Prime Minister Boris Johnson fended off a party revolt on Tuesday over Britain's decision to allow China's Huawei to build parts of its 5G infrastructure.

A group of Conservative party rebels tried to pass a bill which would rip Huawei out of Britain's telecoms by the end of 2022. The government won the vote by a narrow margin of 24 votes.

Digital minister Oliver Dowden said that ideally Britain would exclude all "high-risk vendors" such as Huawei, but that was impossible given its dominant market position.

Visit Business Insider's homepage for more stories.

British Prime Minister Boris Johnson defeated his first party rebellion on Tuesday over a government decision to allow China's Huawei to have a role in building Britain's 5G phone network.

The UK decided in January it would allow Huawei to build "non-core" parts of its 5G network, and capped its involvement at 35%.

This angered the US, which has been aggressively lobbying its allies to exclude Huawei from their 5G networks entirely, alleging that Huawei spies for the Chinese government and constitutes a national security threat. Huawei has consistently denied that it spies for China.

The UK's decision to allow Huawei to be a part of its 5G infrastructure reportedly led to a furious phone call from Donald Trump where he accused Boris Johnson of "betrayal" and slammed the phone down.

Some senior Conservatives shared US concerns. They wanted Huawei eliminated entirely from Britain's 5G networks by the end of December 2022.

The government tried to placate the rebels by saying it would work toward increasing the supply of 5G telecoms gear so operators would not need to use Huawei, but it refused to commit to any timetable to ban the Chinese company.

It was not enough, however, and the rebels pushed their plan to a vote on Tuesday. They wanted to amend the Telecommunications Infrastructure Bill to ensure that companies termed by British security experts as "high-risk vendors" — such as Huawei — were stripped out of networks completely by the end of 2022.

The government, which has an 80-seat majority, won by 24. Although the rebel MPs lost the vote, the narrow margin has left the government with a bloody nose.

Digital infrastructure minister Matt Warman said the government had "heard loud and clear the points made on all sides of the house."

Bob Seely, one of the rebels, signaled the group would continue to pursue their cause, describing the vote as "a strong first showing" in a posting on Twitter.

The government admitted that it is simply too inconvenient to exclude Huawei, saying it did not want high-risk vendors to have any role. But in a market dominated by three players (Huawei, Ericsson, and Nokia) some network operators continue to rely deeply on Huawei.

"We would like to get to the point where we won't need to have any high-risk vendors at all," digital minister Oliver Dowden told parliament.

Huawei vice president Victor Zhang said the company had been "reassured" by the government's decision in January, which would "result in a more advanced, more secure and more cost-effective telecoms infrastructure".

"An evidence-based approach is needed, so we were disappointed to hear some groundless accusations asserted," Zhang said. "The industry and experts agree that banning Huawei equipment would leave Britain less secure, less productive and less innovative."