Thirty-eight Tory MPs have rebelled against the government in an unsuccessful attempt to force Boris Johnson to set out a timetable for excluding Huawei from future 5G phone networks.

The government’s majority was cut to 24 as the rebels were defeated by 306 to 282 on an amendment put down by former Tory leader Iain Duncan Smith, amid concerns over the presence of a Chinese supplier at the heart of Britain’s digital infrastructure.

Had another 13 MPs joined the anti-Huawei revolt, Johnson would have suffered an embarrassing defeat just three months after his comprehensive success in December’s general election.

But the narrow margin of victory is a warning shot to Downing Street, which still has to legislate to implement its plan for a 35% cap on Huawei in 5G in the early summer, although 44 would be needed to have a chance of defeating the government.

Conservative rebels voting against the government included former cabinet ministers David Davis, Iain Duncan Smith, Liam Fox, Damian Green, Esther McVey, Owen Paterson and John Redwood. Others joining them included ERG chair Mark Francois, and Tom Tugendhat, the chair of the foreign affairs committee. But five DUP MPs voted with the government.

The rebels wanted the government to eliminate Huawei ideally by the end of 2022, but Iain Duncan Smith signalled he was willing to consider alternative dates, in an attempt to reach an agreement with ministers over the issue.

“We need to know that it is the government’s intention to rid ourselves of high-risk vendors such as Huawei,” Duncan Smith said, and “to commence the beginnings of that retraction before the end of this parliament.”.

But despite being repeatedly pressed by unhappy backbenchers, Dowden refused to give any timetable for eliminating Huawei from future 5G networks and even appeared to row back on previous commitments for eliminating Huawei at all.

“We’re not in a position today to set out a specific date or timetable for reaching no high-risk vendors, that would require a new decision to be taken by the National Security Council,” Dowden told parliament.

Labour and the SNP backed the Tory rebels, although the vote over an amendment to the telecoms infrastructure bill was technically symbolic, because the bill itself was focused on giving broadband providers access to buildings owned by recalcitrant leaseholders.

Dowden’s offer to the rebels was a promise that the UK would work with the US, Australia and other members of the English speaking Five Eyes intelligence community to “develop new supply chain capacity” – competitors to Huawei - which he said would take place over the course of the current parliament, by the middle of 2024.

But the lack of clarity was not enough for the rebel backbenchers. One frustrated Conservative, former environment secretary Owen Paterson, said that Dowden was “tantalisingly close” to giving them what they wanted. “All we need now is a commitment there will be a date,” to eliminating Huawei, Paterson added.

Last month, Boris Johnson’s government announced plans to cap Huawei’s market share in 5G at 35%. The rebels want the UK to eliminate the Chinese company’s involvement entirely, even though it has been used in British networks since 2003.

The White House and the rebels believe technology from the Chinese firm represents a potential surveillance risk, but Downing Street and Britain’s spy agencies believe any risks can be managed, based partly on their experience of the kit.

Dowden also said that members of the National Cyber Security Centre, an arm of GCHQ, would give evidence to select committees inquiring into Huawei and the telecoms supply chain for the first time in their history.

Earlier, Sir Mike Rake, a former chairman of BT Group, who is now an adviser to Huawei, warned: “Any attempt to further restrict Huawei 5G equipment, or to remove existing 4G equipment will not only incur very significant costs, but prejudice trade relationships with China and will significantly set back the government’s broadband ambitions.”