Theresa May’s cabinet descended into rows and recriminations before it settled on the uneasy decision to invite Jeremy Corbyn to help solve the UK’s Brexit crisis.

During seven hours of meetings on Tuesday described as tense and gruelling, the prime minister struggled to keep order among colleagues who are vying to take her job.

The outcome provoked disbelief and anger from members of the Conservative party’s largest Eurosceptic grouping, the European Research Group (ERG), some of whom doubted that they could support a subsequent deal.

Cabinet sources said that both the political cabinet in the morning and the government cabinet in the afternoon were fractious and bad-tempered, with at least 14 members warning against being forced by parliament to accept an option leading to a long extension rather than no deal.

Gavin Williamson, the defence secretary, was among those opposing a long delay, asking the prime minister directly how long a Brexit extension she would be willing to accept, according to cabinet sources who said May declined to answer.

Geoffrey Cox, the attorney general whose evidence that the UK risked being trapped in the Irish backstop indefinitely helped sink May’s deal at the second meaningful vote, urged the prime minister to make concessions to Corbyn to win a majority.

Cox spoke after several ministers had argued against any further extension to article 50, and said government had to shift its position. “He said, give Labour whatever they want to get it over the line,” said a cabinet source. In what was described by two sources as one of the key moments, Michael Gove strongly agreed.

Williamson warned that the EU27 would be unlikely to offer any fresh concessions on the backstop if the risk of a no-deal Brexit was removed, sources said.

One source said a particularly tense moment came when Claire Perry, the climate change minister, “went on a rant” about rightwingers changing the direction of Brexit policy. Her comments provoked a strong reaction from Cox, who “bellowed from the other end of the table” that such language was unhelpful, forcing the prime minister to intervene.

At the political inner cabinet, ministers were also given a sobering briefing about the Tories’ prospects in a general election, and their readiness to mount a campaign, by party chair Brandon Lewis and treasurer Mick Davis.

More than 60 MPs and peers who support the ERG gathered in committee room 15 of the House of Commons on Tuesday to watch May’s televised invitation to Corbyn.

One member said they let out a collective gasp when the prime minister said she would invite Labour’s leader into No 10 for talks. Some claimed they were already receiving emails of resignation from Tory members in their constituencies.

Others suspected that May would use Corbyn to seek a customs union with the approval of the EU, a move which they say runs contrary to the result of the 2016 referendum.

Former minister Conor Burns, who is from Northern Ireland, said that the deal was proof that May’s government had collapsed.

The MP said: “The UK no longer has a functioning government of executive control. The prime minister has handed the future decisions over Brexit to the Labour party. It will now be for Corbyn, Diane Abbott and John McDonnell to decide if the Conservative party implements its manifesto.

“It is a very bleak day and a day I fear that a remainer parliament is going to foist upon a British electorate something that none of them voted for.”

As the meeting broke up, Jacob Rees-Mogg, the ERG’s chair, criticised the prime minister for planning to collaborate with “a known Marxist” and said the move would lose Tory votes.

“You do find that leaders who decide to go with the opposition rather than their own party find their own party doesn’t plainly follow,” he said. “I’m not sure this is the way to conciliate people to persuade them if they haven’t moved already to move at this stage. I think getting the support of a known Marxist is not likely to instil confidence in Conservatives.”

Asked if he would support any form of call for no confidence in the prime minister, Rees-Mogg said he would not try to oust May again, having failed in an attempt in December.