The MPs of the British parliament have voted to take control of Commons business in an unprecedented move to try to find a majority for any Brexit option.
The government was defeated by 329 votes to 302 on the cross-party amendment, a majority of 27.
It means MPs will get a series of votes on Wednesday to find out what kind of Brexit they will support.
Prime Minister Theresa May has said there is no guarantee she will abide by their decision.
But Labour Leader Jeremy Corbyn, who had backed the amendment tabled by Conservative Sir Oliver Letwin, said the government "must take the process seriously".
He added: "The government has failed and this House must, and I believe will, succeed."
He said MPs would want to find a consensus on the way forward, including a possible "confirmatory vote" on the PM's deal by the public - something Theresa May told MPs earlier she did not want because Remain would be on the ballot paper.
Theresa May had earlier tried to head off a defeat by offering MPs a series of votes on Brexit alternatives, organised by the government.
She said allowing MPs to take over the Commons agenda would have set an "unwelcome precedent".
But supporters of Sir Oliver Letwin's amendment said they did not trust the government to give MPs a say on the full range of Brexit options.
Thirty Tory MPs voted against the government, including three ministers - Richard Harrington, Alistair Burt and Steve Brine - who have now resigned from their ministerial posts.
Following the vote, Shadow Brexit Secretary Sir Keir Starmer tweeted: "Another humiliating defeat for a prime minister who has lost complete control of her party, her Cabinet and of the Brexit process.
"Parliament has fought back - and now has the chance to decide what happens next."
In the series of so-called indicative votes, MPs will be able to vote on a series of options - likely to include a "softer Brexit" and another referendum - designed to test the will of Parliament to see what, if anything, commands a majority.
The prime minister said she was "sceptical" about the process - as it was not guaranteed to produce a majority for any one course of action - and she would not commit the government to abiding by the result.
"No government could give a blank cheque to commit to an outcome without knowing what it is," she told MPs.
"So I cannot commit the government to delivering the outcome of any votes held by this House.
"But I do commit to engaging constructively with this process."
The government narrowly defeated a bid by Labour's Dame Margaret Beckett to give MPs a vote on asking for another Brexit extension if a deal has not been approved by 5 April. Dame Margaret's amendment was voted down by 314 to 311, a majority of three.
The government was defeated on its main motion, as amended by Sir Oliver Letwin, by 327 votes to 300, a majority of 27.