Boris Johnson is prepared to back down on his threat to break international law by unilaterally ripping up parts of the Brexit divorce deal he signed with the European Union, the government announced Monday.

The plan to retreat on the U.K. Internal Market Bill, first reported by Bloomberg in October, is another sign that the prime minister’s government is trying everything it can to smooth the path to a new post-Brexit trade agreement with the EU.

Talks in Brussels are at a critical stage and both sides have said they are far apart on key issues, including fisheries and fair competition rules, amid warnings the negotiations could fail.

One of the issues that soured talks earlier in the year was the U.K. government’s decision to draft new legislation that would override parts of the Withdrawal Agreement Johnson struck with the EU.

Ministers said the clauses -- in the Internal Market Bill -- are intended as a safety net to prevent a customs border going up between Northern Ireland and mainland Britain if no agreement could be reached on the issue.

The EU threatened legal action against the U.K., saying the legislation would breach the Brexit agreement. But officials have been negotiating in the months since, and on Monday the government confirmed it would be willing to drop the measures from the legislation if they are no longer needed.

Even so, lawmakers in the House of Commons voted by a wide majority in a series of votes late Monday to back the contentious clauses, after ministers said it would be “prudent” to keep them in the bill.

The votes overturned amendments to the legislation by the House of Lords, which had voted to remove the clauses after ministers admitted they would break international law.

“It’s only prudent that until such a time as these discussions have successfully concluded, we retain these clauses in their current form as a fall-back option,” Business Minister Paul Scully told MPs on Monday.

Cabinet Office Minister Michael Gove held talks with the EU in Brussels to review the implementation of the Withdrawal Agreement in an attempt to find a solution to differences over border arrangements.

“Discussions continue to progress and final decisions are expected in the coming days,” the government said in a statement Monday. Ministers would be willing to scrap the contentious clauses “if the solutions being considered in those discussions are agreed,” according to the statement.

The Internal Market Bill would give U.K. ministers powers to determine what goods entering Northern Ireland are at risk of being moved in to the EU and therefore could be subject to tariffs.

The U.K. insists the law will protect its own internal market but has accepted that the clauses do break international law.

--With assistance from Alex Morales and Thomas Penny.