Labour members are to vote on keeping “all options on the table” on Brexit, including possibly campaigning for a new referendum, at their conference.
The party’s leadership wants a general election allowing Labour to take control of negotiations if it won.
However some members want the party to pursue a “people’s vote” on Brexit.
Shadow chancellor John McDonnell told the BBC he thought any such vote should be on the terms of a Brexit deal rather than an option to stay in the EU.
He said that Labour would continue to respect the 2016 referendum, in which people voted by 51.9% to 48.1% for the UK to leave the European Union.
And he said a general election was needed so a Labour government could strike a Brexit deal with the EU which “brings the country together”.
But shadow Brexit secretary Sir Keir Starmer told the BBC the party was deliberately not being “prescriptive” about the question that could be posed in another referendum, saying it was “certainly not ruling out” the option to stay in the EU.
Labour leader Jeremy Corbyn accepted he would be “bound” by the outcome of Tuesday’s conference motion.
‘Consensus in room’
Key delegates – including Sir Keir and leading figures from some trade unions – decided the text at a meeting which lasted several hours on Sunday evening.
The final draft for the vote says: “If we cannot get a general election, Labour must support all options remaining on the table, including campaigning for a public vote.”
A source told the BBC’s political editor Laura Kuenssberg: “There was consensus in the room opposing the Tories’ chaotic approach to the Brexit negotiations… and that a general election should be called as soon as any deal is voted down by parliament.
“It was then agreed that if we cannot get a general election Labour must support all options remaining on the table, including campaigning for a public vote.”
The Labour Party has never formally rejected the option of a so-called people’s vote on Brexit, but both Mr Corbyn and his deputy, Tom Watson, have indicated they would prefer it to be resolved by a general election.
By Iain Watson, BBC political correspondent
After what I am told was six re-drafts and five and a half hours of discussion, wording that could bridge the gap between campaigners for a new referendum and a reluctant leadership was agreed.
But what was left out of the conference motion is as important as what went in.
The leadership had to agree that wording which restricted a future referendum to “the terms of Brexit” had to go.
This means that the party could, in theory, back a referendum that gave voters the option of remaining in the EU and not just a vote on the final deal.
Campaigners for a new vote see this as significant step forward.
But allies of Jeremy Corbyn say the wording doesn’t commit him to backing a referendum as it is still only “an option on the table” if Theresa May refuses calls for a general election.
So still a fudge of sorts – but one with a slightly sweeter taste for supporters of a new vote who firmly believe that “all options” will become their option.
However, even the hint of a new referendum will allow the Conservatives to claim that Labour weren’t serious enough about respecting the previous one.
Pressed on the issue on BBC One’s Andrew Marr Show on Sunday, Mr Corbyn, who has said he is not calling for another referendum, said “our preference” is for a general election.
He said that would then allow a Labour government to negotiate the UK’s future relationship with Europe.
“Let’s see what comes out of conference. Obviously I’m bound by the democracy of our party,” he added.
Mr Corbyn also told the programme the UK “could be” close to a general election. Amid speculation that Labour could force a vote of no confidence in Prime Minister Theresa May if Parliament rejects any Brexit deal, he said: “We will be putting our case to Parliament and we will see what happens after that. We are absolutely ready for it.”
He said Labour would be prepared to vote down any deal Mrs May came back with, if it did not meet a series of tests Labour has set out.
However, Brexit Secretary Dominic Raab has ruled out a snap election this autumn, saying the idea was “for the birds”.
The UK is due to leave in March 2019 and Theresa May has been negotiating with other EU leaders on the UK’s future relationship with the bloc.
Talks hit a stumbling block at a summit in Salzburg on Thursday when EU leaders rejected Mrs May’s plan for Brexit – known as the Chequers agreement, and she warned them she was ready to walk away rather than accept a “bad deal”.
For the Lib Dems, who want to stop Brexit, Tom Brake said “Labour leaders are aiding and abetting Theresa May on Brexit” and accused them of trying to “trick and stitch up their own conference” .
He said that any referendum had to include the option of remaining in the EU, because “the only choice a ‘deal or no deal’ vote gives people is which foot to point the gun at”.
What the Labour wrangling means
By Newsnight political editor Nick Watt
The wrangling has led to much soul searching in the new Labour movement taking shape under Jeremy Corbyn’s leadership. The Momentum group, established to shore up his leadership at the grassroots, has been torn between pro-European instincts and loyalty to Corbyn.
He is heir to the Bennite tradition which regards the founding principles of the EU as anathema to Socialism.
Momentum was thinking of taking a neutral position had the motion been difficult for Jeremy Corbyn. One Momentum source told me that, while the organisation is strongly pro-European, it would do nothing to jeopardise its main goal; the election of a truly Socialist government.
The People’s Vote campaign are reasonably content. They know their greatest weakness in Liverpool is they are seen as a bunch of unreconstructed Blairites seeking to thwart the will of the people on the EU and undermine Corbyn in the bargain.
The campaign believe they have shown they have far wider support. They hope to have created a space in November for Labour to be able to endorse a referendum on the grounds that warring Conservative MPs agree on one thing – there must be no general election before 2022.
In a statement on Sunday, the prime minister said “many in Labour, the Liberal Democrats and the SNP are trying to thwart Brexit at every step and seeking to exploit this moment for political gain” by calling for another referendum and extending Article 50 to delay Brexit.
Labour’s conference in Liverpool began on Sunday with policy announcements on plans for worker representation on company boards and to make employers provide up to 10 days’ paid leave for victims of domestic violence.
Announcements on Monday will include:
Brexit is among eight issues to have been chosen for debate at the conference in Liverpool after a ballot by Labour members and trade unions.
The others are Palestine, the economy, housing, schools, government contracts, in-work poverty and justice for the Windrush generation.