British legislators have overturned changes to the government's flagship Brexit bill made by Parliament's House of Lords, removing a promise to reunite child refugees with their families in the United Kingdom.

As the bill went through its final stages before becoming law, the House of Commons on Wednesday removed five amendments inserted into the Withdrawal Agreement Bill by the unelected upper chamber.

The UK is scheduled to leave the European Union on January 31.

More:

The Lords voted Tuesday to demand that the post-Brexit UK continues to let unaccompanied migrant children in EU countries join relatives living in the UK.

The promise was made in 2018 by former British Prime Minister Theresa May, but it was removed from the Brexit legislation after Prime Minister Boris Johnson's Conservatives won a big parliamentary majority in an election last month.

Johnson's government says it intends to continue resettling child migrants in the UK after the country leaves the EU but argues that the issue does not belong in the EU withdrawal bill, which sets out the terms of the UK's departure from the 28-nation bloc.

Brexit Secretary Stephen Barclay said an agreement on taking in the children "is ultimately a matter which must be negotiated with the EU, and the government is committed to seeking the best possible outcome in those negotiations."

But Labour peer Lord Alf Dubs, who was behind the push to enshrine rights for child refugees, tweeted: "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?"

Lord Alf Dubs, a British legislator who fled Nazi Germany as a little boy, speaks at a protest to demand protection for rights for refugee children, in Parliament Square in London on January 20, 2020 [Tolga Akmen/AFP]

Labour legislator David Lammy said, "Shame on this government for putting child refugees in danger."

The House of Commons also stripped out changes made by the Lords to bolster the rights of EU citizens in the UK, protect the powers of British courts and ensure a say for Scotland and Wales in post-Brexit legal changes.

The wrangling will not stop the Brexit bill from becoming law within days, because the House of Commons can override the unelected Lords.

Members of the Lords acknowledged Wednesday that they would have to give way.

"We are at the end of a very long road," said Martin Callanan, a Brexit minister in the Lords.

The EU parliament also must approve the Brexit divorce deal before January 31. A vote by the European Parliament is expected next week.