Labour is ready to vote for a general election as soon as EU27 leaders have signed off on a Brexit extension, despite the desire of some senior party figures to secure a referendum first, the Guardian understands.

Labour has twice abstained when the prime minister asked for an election under the terms of the fixed-term parliaments act, which requires a two-thirds majority.

But Jeremy Corbyn has repeatedly said that once an extension was in place he would support a poll and a Labour spokesperson confirmed on Wednesday night that remained the party’s position. “Extension, then election,” he said.

Boris Johnson has threatened to make a fresh bid to secure a general election if the EU27 leaders hand the UK a three-month Brexit delay, as requested in the letter he reluctantly sent on Saturday.

After the government was defeated on Tuesday in its last-ditch bid to secure Brexit by 31 October, Johnson said he would consult EU leaders about what they planned to do next and report back to parliament.

He could seek a general election immediately or wait to see whether his Brexit bill is amended in some way he is unable to accept, such as by forcing him to seek a customs union.

Following the vote, the Conservatives released social media messages saying Jeremy Corbyn had “humiliated the country again.”

Conservatives (@Conservatives) Tonight Jeremy Corbyn and Labour voted to delay Brexit again and create more uncertainty. They have humiliated the country again. pic.twitter.com/rVLSXLDCVM

Nineteen Labour MPs, including Gareth Snell, Gloria De Piero and Ruth Smeeth, rebelled against the whip to help the prime minister to a healthy majority of 30 in the second reading of the withdrawal agreement bill.

During the debate, De Piero told Corbyn: “I want to improve the deal so that it reflects the manifesto that I stood on and respects the referendum result, and so that we leave with a deal that protects jobs and trade.”

He replied: “I fully understand both her concerns and their concerns. I commend her for her work in representing that area and the obvious friendship that exists between her and all the people she represents; she is a great MP”.

Seven of the group subsequently published a statement saying that, while they had reservations about the deal, they believed it was right to allow it to continue to be debated, to “give us a proper chance to get a Labour Brexit”.

Only five Labour MPs then supported the government’s programme motion, which would have resulted in the deal being rushed through the House of Commons by the end of Thursday.

Labour frontbenchers discussed the timing of a potential election at a testy shadow cabinet meeting on Tuesday, with Corbyn loyalists Laura Pidcock and Dan Carden calling for the party to back an early poll.

Carden told colleagues the “referendum first” approach espoused by some of his colleagues was a fantasy, which wouldn’t win a majority in parliament and which the government would anyway refuse to implement.

The deputy leader, Tom Watson, has argued publicly that it would be better for Labour to settle the issue of Brexit in a referendum and then contest a general election on a wider set of issues.

At the shadow cabinet meeting, the shadow Brexit secretary, Keir Starmer, clashed with colleagues over Labour’s stance on a second referendum.

According to those present, Corbyn opened the meeting by reminding shadow cabinet members not to stray from Labour’s agreed policies in media appearances.

Starmer then suggested existing Labour policy meant the party must support any amendment to the government’s withdrawal agreement bill calling for a referendum on Johnson’s Brexit deal, and then campaign for remain.

But in a debate that became fractious at times, according to two people present, Starmer faced a backlash from colleagues including Ian Lavery and Jon Trickett.

One witness said Lavery accused Starmer of “ramming this policy down my throat for 18 months”.

In the shadow cabinet discussions about whether Labour would campaign for remain against Johnson’s deal, Lavery and Trickett pointed to the motion passed at last month’s Labour conference in Brighton, which said: “The party shall only decide how to campaign in such a referendum through a one-day special conference, following the election of a Labour government.”

Party members backed the motion after Corbyn made clear he wanted the decision about its referendum stance to be taken after a Labour government came to power.

The shadow home secretary, Diane Abbott, also expressed concerns about supporting a compromise similar to the Kyle-Wilson amendment.

The Labour MPs Peter Kyle and Phil Wilson previously suggested they could support Theresa May’s withdrawal agreement if it was subjected to a confirmatory referendum. But Corbyn said he would “caution” MPs against being willing to accept that quid pro quo.

Quick guide How is Boris Johnson's Brexit deal different from Theresa May's? Show Hide The new Brexit deal is essentially the old Brexit deal with a new chapter on the protocol on Ireland and Northern Ireland and a few key tweaks to the political declaration. Here is a link to the full text. The backstop is replaced The backstop has essentially been replaced by a full stop whereby Northern Ireland remains aligned to the EU from the end of the transition period for at least four years. A change can only happen if it is voted on by the Stormont assembly. Consent Stormont will have a key role in future Brexit arrangements. And if there is cross-community support to remain aligned to the EU rather than the UK the consent will hold for eight years. The arrangements in this deal will automatically kick in for a mandated four years if there is a breakdown in trade talks, so it remains a “backstop” but with a permanent tinge. That four-year period will start at the end of December 2020. Two months before the end of the four-year period, that is October 2024, Stormont will be asked to vote on whether to remain aligned to the EU in ways outlined by this deal or not. Checks on border, ports and airports Under the deal, the UK and the EU are “underlining their firm commitment to no customs and regulatory checks or controls and related physical infrastructure at the border between Ireland and Northern Ireland”. Future trade deals The EU and the UK will aim for a zero-tariff deal with unlimited quotas. The entire UK, including Northern Ireland, will be free to sign trade deals. The line in the political declaration that “the United Kingdom will consider aligning with union rules in relevant areas” in any future trade talks has been ditched. Customs Northern Ireland will remain legally in the UK customs territory but practically in the EU customs unions. There will therefore be no customs checks on the border but tariffs will be payable on certain commercial goods. No customs duties will be payable on “personal property” being transited from Great Britain to Northern Ireland. That protects online shopping and all items bought for personal rather than commercial use. Customs duties will be payable on goods imported from the UK for commercial use unless it can be demonstrated that the goods remain in Northern Ireland or are for personal use, as above. A system of rebates will allow importers to be reimbursed. West/east trade The commitment to frictionless trade between Northern Ireland and Great Britain is restated. VAT EU law on VAT will apply in Northern Ireland. Single electricity market The island of Ireland is considering a single market for electricity so homes in Northern Ireland can get their energy from a supplier in Northern Ireland or the republic. There were fears this could be disrupted by Brexit. Under the Johnson deal, the provisions of union law remain so nothing will change. Level playing field This guarantees that the UK will remain in line with EU conventions on climate, environment and workers rights in a future trade agreement. Lisa O'Carroll Brexit correspondent

Abbott said last month: “I don’t think we should be supporting a bad deal, just because it’s got a referendum attached. That’s why I was against Kyle-Wilson.

“Either it’s a good deal, which says something about the customs union, and alignment with the single market – or it’s not. The referendum is not an end in itself. Kyle-Wilson has resurfaced, and it was a bad idea the first time around, and I don’t support it.”

Starmer, the shadow foreign secretary, Emily Thornberry, and the shadow chancellor, John McDonnell, have said publicly they would like to campaign for remain.

But Trickett said earlier this month that he did not support the idea of a referendum that would pitch Johnson’s deal against remain.

“A referendum before the election would imply a Tory Brexit against remain. I believe that the majority in the country voted for leave – and I feel that a Labour Brexit can only be delivered by a Labour government.”