Peers have defeated the government in voting to give Parliament a potentially decisive say over Brexit.
An amendment to the EU Withdrawal Bill giving MPs the power to stop the UK from leaving without a deal, or to make Theresa May return to negotiations, was approved by 335 votes to 244.
Its supporters said Parliament, not ministers, must "determine the future of the country".
The government will now try to persuade MPs to strike out the change.
Ministers said giving Parliament a decisive say on the Brexit deal risked "weakening" the UK's hand in negotiations.
But Labour said the vote marked a "hugely significant moment" in the fight to ensure Parliament has a "proper role" in the Brexit negotiations and a no-deal situation was avoided.
It was one of three government defeats on the Brexit bill on Monday evening.
Analysis by the BBC's Alex Forsyth
So far, the government has framed Parliament's vote on a final Brexit deal as a stark choice; take it or leave it.
The implication - if MPs reject whatever terms are negotiated - the UK would leave the EU without a deal on future relations.
But this amendment agreed by the House of Lords could prevent that, by giving Parliament the power to decide what happens if MPs turn down the final agreement.
The result will embolden those pushing for a greater role for Parliament in the process.
The bill will return to the Commons before anything is finalised - and with some Tory peers again proving their readiness to defy their party vote with the opposition, the question is how many Conservative MPs are prepared to do the same.
The UK is due to leave the European Union on 29 March 2019.
Both sides hope to negotiate the UK's withdrawal agreement by this October in order to give the UK and European Parliaments enough time to debate and vote on it before the moment of departure.
The amendment proposed by Conservative Viscount Hailsham would allow Parliament to determine the government's course of action if MPs rejected the deal or if the UK and EU were not able to reach an agreement of any kind.
It would also give Parliament control of the process if the legislation enshrining the withdrawal treaty promised by ministers was not approved by 29 March 2019.
The peer, who as Douglas Hogg was an MP for many years, told the House of Lords the principle of parliamentary sovereignty was "fundamental to our liberties and must not be betrayed" when it came to Brexit.
"Whatever our party affiliation, our duty as parliamentarians is to our country and our conscience," he said.
But former Conservative leader Lord Howard said the idea of effectively giving Parliament a veto over Brexit - which the public voted for in a 2016 referendum - was "fundamentally misconceived".
"I'm afraid it reveals the appalling lengths to which the die-hard Remainers are prepared to go to achieve their aims," he said.
During the debate, government spokesman Lord Callanan said Parliament's vote would be binding and if it did reject the deal, the Article 50 process - determining the timetable for leaving - would "kick in" and the UK would leave.
Speaking afterwards, he said ministers would consider the implications of the vote.
"What this amendment would do is weaken the UK's hand in our negotiations with the EU by giving Parliament unprecedented powers to instruct the government to do anything with regard to the negotiations - including trying to keep the UK in the EU indefinitely."
In December, MPs voted in favour of a legal right to have their say on the withdrawal deal.
Last week Brexit Secretary David Davis said the motion to be considered by MPs on the final deal would be amendable - raising the prospect of MPs having greater influence over the process.
The government suffered another defeat later on Monday, as peers voted by 270 to 233 in favour of an amendment requiring ministers to get approval from Parliament for their aims in talks about the UK's future relationship with the EU.
The Brexit department said it was "disappointed" that the Lords had backed the amendment, saying Parliament had been "updated regularly throughout the negotiations".
The government, which does not have a majority in the Lords, also lost a vote on family reunification for asylum seekers after Brexit after peers backed an amendment by Labour's Lord Dubs.