Peers have approved Boris Johnson's Brexit bill, but not before making changes to the legislation.
The House of Lords voted in favour of five amendments over two days of debate, leading the new government to its first parliamentary defeats.
The changes included backing the Dubs amendment to protect the rights of refugee children after Brexit.
No 10 said they were "disappointed" by the move, but planned to overturn them when the bill returned to the Commons.
If the amendments are voted down by MPs on Wednesday - highly likely due to the Conservatives' 80-strong majority in the House - the so-called "ping-pong" period between the two chambers will begin.
This means the bill will pass between the two Houses until both sides agree on the wording.
The Brexit bill - officially called the EU (Withdrawal Agreement) Bill - ensures the UK leaves the EU on 31 January with a deal.
It passed through the Commons unamended by 99 votes, but has had a tougher battle through the Lords.
On Monday, peers agreed amendments on EU citizens, EU Court of Justice rulings and court independence, seeing three defeats for the government.
Earlier, the Dubs amendment - allowing child refugees to be reunited with their families in the UK post-Brexit - passed by 300 votes to 220, making a fourth loss.
A short time later, a fifth amendment narrowly got the backing of peers - with the government losing by 239 votes to 235 - changing the bill so it makes note of the Sewel Convention, under which Parliament should not legislate on devolved issues without the consent of the devolved institutions.
The amended bill was passed by peers on Tuesday night without needing a vote, and will now return to the Commons on Wednesday afternoon after Prime Minister's Questions.
'Turning a deaf ear'
Brexit minister Lord Callanan said it was the "right and duty" of peers to "rigorously scrutinise" legislation and to ask MPs to "think again when you think that is appropriate".
But he added that he would "like to... remind noble lords that we received a clear message from the elected House" who overwhelmingly supported the bill.
Labour's Lady Hayter criticised the government for "turning a deaf ear to improvements" made by the amendments.
And Liberal Democrat peer Lady Ludford said her party's mind had not been changed, adding: "We continue to think Brexit is a mistake and that the UK will sooner or later rejoin the EU. I just wish the government was in listening mode".
But Tory peer Lord Hamilton said there had been "a conspiracy... of Remainers" throughout Parliament "trying to ensure we stay in the EU".
He accused colleagues of planning to "make negotiations [with the EU] as difficult as possible for the government so they get a very bad deal, and they can then be justified in their view we should never have left".
His fellow Conservative, Lord Cormack, said the comments equated to "the most ill-judged speech I have heard for many long years".
He added: "The will of the people must, of course, prevail. But to pretend this House has behaved improperly is wrong."