Boris Johnson and Jeremy Hunt will battle it out to become Britain’s next prime minister after a day of drama at Westminster that saw Johnson’s team accused of conniving to knock his bitter rival Michael Gove out of the race.

The environment secretary drew narrowly ahead of Hunt in the fourth round of voting among Tory MPs on Thursday, which saw Sajid Javid knocked out.

But when the results of the fifth and final round were announced at 6pm, Hunt had narrowly beaten Gove, by 77 votes to 75.

Suspicions were raised by the fact that Johnson’s vote increased by just three MPs between the rounds, from 157 to 160 – despite the fact that at least four Javid supporters had publicly declared their backing for Johnson, during a nail-biting afternoon of lobbying in Westminster’s wood-panelled corridors.

Facebook Twitter Pinterest Michael Gove lost out to Jeremy Hunt by just two votes. Photograph: David Mirzoeff/PA

Johnson’s camp also believe remain-voting Hunt, whom some at Westminster dub “Theresa in trousers”, will make a less formidable adversary than Gove, who along with Johnson was one of the leading figures in the Vote Leave campaign.

However, Conor Burns, the Bournemouth MP and a key member of the Johnson team, dismissed the idea that they had deliberately aided the foreign secretary by lending him votes.

He said: “The message came from Boris: if people want to support me they vote for me, no pissing around. We wanted at every stage to make progress. We wanted to go to the members with more than half of the party voting for Boris. That’s a really strong mandate and message from our parliamentary colleagues to our members in the country – get onboard and let’s bring it all together.”

Gove’s campaign manager, Mel Stride, the leader of the House of Commons, said he was not concerned about skulduggery from the Johnson camp. “It would appear to me everybody has behaved pretty much as one would hope,” he said.

Hunt himself hit the phones in his Westminster office in the afternoon, to warn his colleagues that allowing Gove into the final pair would turn the race into a “psychodrama” between the two faces of Vote Leave.

Johnson and Hunt’s names will now go forward to the Tory membership of around 140,000 – with Johnson the overwhelming favourite to take possession of the keys to No 10 next month.

And then there were two - Politics Weekly podcast Read more

But with the party’s working majority in parliament a wafer-thin five, some senior Tories are already warning that whoever wins could find themselves forced to call a general election within months – or even weeks.

Several pointed to the fact that two MPs spoilt their ballots as evidence that some disillusioned Tories may find it hard to support either candidate.

With a recall petition in Brecon and Radnorshire threatening to remove another Tory MP, and several on their own side determined to resist a no-deal Brexit, even at the cost of their own seats, the Tories’ working majority of six appears highly vulnerable.

“He might have a premiership that is the shortest in history,” one Tory frontbencher said. “He could have a confidence vote on his first day and be prime minister for ten minutes – if we lose in Brecon, we may have a majority of three by then and two colleagues have spoilt their ballots. They are effectively saying they could not countenance any of these options as prime minister.”

Before they get the chance to test their support in the House of Commons, the candidates will first have to face 16 hustings events for party members, at which the pair’s plans for Brexit will come under scrutiny. And they will also take part in a head-to-head televised debate, on ITV.

A source from Johnson’s campaign team said they were looking forward to the “battle of ideas”. They dismissed the idea that he could struggle to command a majority, saying, “he’s shown the breadth of his appeal across the party, from Matt Hancock to Steve Baker”.

Johnson used an interview with the Evening Standard on Thursday to signal that he will continue to rein in his usual flippancy, as he tries to demonstrate that he is ready for Downing Street.

“I do think it is time we had some excitement back into politics, I do, but there’s also quite a serious job of work to be done,” he said.

Hunt, who is the son of an admiral and was head boy at Charterhouse school and president of the Oxford University Conservative Association, described himself as the underdog.

“I’ve been the underdog right from the start and I like to prove people wrong. And the way I’m going to win this race is by showing that the best way to Brexit is by sending the European Union a prime minister they can engage with, a tough negotiator, someone who has a bottom line and won’t give up until I get what is right for our country. But also someone who is prepared to walk away.”

Johnson has repeatedly promised that he will take Britain out of the European Union before the latest deadline of 31 October – and many moderate Tories have grave concerns that he may be ready to risk a no-deal Brexit.

In an outspoken warning to the final candidates David Lidington, the de facto deputy prime minister, warned them to not focus too narrowly on courting the Tory faithful, saying the party faced “existential” problems, while Brexit was placing the union at grave risk.

Speaking after he voted in the final round, before the result was announced, Lidington said it was 1992 when the Conservatives last won a clear majority, while its electorate was ageing, and the 2017 election saw it lose support among BAME voters.

“The Tory party is facing some existential political challenges, and the union of the United Kingdom is under greater strain than I have never known it in my lifetime,” Lidington said.

“There are some key constitutional issues, some really key political challenges for the party, and I think it’s really important that the candidates show they’re up for addressing that.”

On the union, Lidington said: “The fact that England and Wales voted to leave in the referendum and Scotland and Northern Ireland voted to remain adds to those political tensions.” A no-deal Brexit “would add to the risks to the union,” he added.

After he was eliminated, Javid said he hoped his candidacy could be an example “to kids who look and feel a bit different to their classmates, those who don’t have as many toys, or private tutors, those who feel like outsiders and wonder whether ‘opportunity’ is just for other people”.