Boris Johnson's Brexit bill is one step away from becoming law after completing its passage through Parliament.
The EU (Withdrawal Agreement) Bill, which paves the way for the UK to leave the bloc with a deal on 31 January, is now awaiting royal assent.
Earlier, MPs overwhelmingly rejected all five changes - including on child refugees - made by peers to the bill.
It then returned to the Lords where peers backed down, despite some anger at their voices being "dismissed".
Now it has completed its passage through Parliament, the UK's exit from the EU must be approved by the European Parliament next week.
In the House of Lords, Labour peer Lord Howarth said MPs had "dismissed the changes requested with no serious consideration".
He said peers accepted the government had a mandate to deliver Brexit but had "sought to improve" the legislation.
Nevertheless, peers chose not to continue a battle with the Commons and agreed to allow the bill to pass.
A total of five amendments to the bill were sent to MPs for consideration from the Lords, including on EU citizens' rights, the power of UK courts to diverge from EU law and the independence of the judiciary after Brexit.
Another, the so-called Dubs amendment - which reinstated a guarantee that unaccompanied refugee children could continue to join relatives in the UK after Brexit - was also demanded by peers.
A fifth amendment called for the bill to be changed to take note of the Sewel Convention, which states that Parliament should not legislate on devolved issues without the consent of the Scottish Parliament, the Welsh Assembly and the Stormont Assembly in Northern Ireland.
As expected, with its large majority in the Commons, the government successfully overturned all five earlier on Wednesday.
Baroness Hayter, deputy Labour leader in the Lords said she regretted "what it says about the new government and its willingness to listen" to the devolved administrations, legal experts, and others.
"Legislation is meant to be a dual responsibility," she said. "Let's hope this is a one off and that normal service will shortly resume."
The Dubs amendment, in particular, was well-supported in the Lords and a number of MPs also argued in favour of it.
It would have required the government to commit to negotiating an agreement with the EU on child refugees - hardening up the existing promise in the bill merely to make a statement on the issue within two months.
Ministers say they back the principle of the Dubs amendment but the Brexit bill is not the right vehicle for it.
Brexit Secretary Stephen Barclay defended the government's record, saying more than 41,000 refugee children had settled in the UK since the start of 2010, including 3,500 unaccompanied children in the year to September 2019.
He said there was no point legislating before the UK reached an agreement with the EU on future numbers.
But shadow Brexit minister Thangam Debbonaire said it would be a mistake to take the government's promises on child refugees at face value.
"The government's predecessor government has got form on this, promising to take 3,000 children on the Dubs scheme, as originally committed to, and taking fewer than 500 in the end," she said.
"The government asking us to trust them... is just not good enough."
In the end, MPs voted, by a margin of 342 to 254, to reject the Dubs amendment, something the peer himself said was "bitterly disappointing".
It is bitterly disappointing that after a victory in the Lords the government have voted down my amendment in the Commons. What could be more humane than asking that unaccompanied child refugees stranded in Europe be able to join relatives in this country? https://t.co/XiwoY0FIiz— Alf Dubs (@AlfDubs) January 22, 2020
Green MP Caroline Lucas called the move "a Tory compassion by-pass".
The Brexit bill is likely to be granted royal assent in the next day or two.
What questions do you have about Brexit and how it will affect you in the future?
Use this form to ask your question: