Brexit: Why is the Internal Market Bill controversial?
The government has said it is willing to drop parts of a controversial piece of legislation - the Internal Market Bill - which had the potential to further complicate the already tense trade talks between the UK and the EU.
It contains measures relating to the way trade will be done between Northern Ireland and Great Britain in the future.
They would only come into force if the UK and the EU failed to reach a trade deal. But they would overrule parts of the Brexit withdrawal agreement the UK signed with the EU last year.
The House of Lords voted to remove the offending clauses from the bill in November but the House of Commons then voted to reinstate them.
The government now says it is willing to withdraw them because of an "agreement in principle" on a range of issues affecting Northern Ireland.
So, what is the controversy about?
Breaking the law
The withdrawal agreement (also known as the Brexit "divorce deal") includes a section - or protocol - on Northern Ireland, and it is now an international treaty.
Article 4 of the agreement says the provisions of the treaty take legal precedence over anything in the UK's domestic law.
So if any of the proposals in the Internal Market Bill that contradict the withdrawal agreement actually became law, it would breach the government's international obligations.
That is what the Northern Ireland Secretary, Brandon Lewis referred to in September when he spoke about breaking international law in a "very specific and limited way".
Breaking the law, though, is still breaking the law.
What was agreed on Northern Ireland?
The overall aim of the Northern Ireland protocol was to avoid the return of a "hard" land border between Northern Ireland, in the UK, and the Republic of Ireland, in the EU.
All sides agreed they did not want the return of border checks - or other physical infrastructure - that could become a target.
One of the solutions in the treaty was to keep Northern Ireland in the EU single market for goods, unlike the rest of the United Kingdom.
It promised to maintain unfettered access for Northern Ireland goods to the rest of the UK but also introduced new bureaucracy for trade across the Irish Sea.
So what's the problem?
The way these measures will be implemented on the ground have been negotiated by UK and EU officials, who have been meeting in a joint committee for the past few months.
If there was no agreement by the end of the transition period, on 31 December 2020, and there was no free-trade deal, that is when parts of this new proposed legislation would have come into play.
For example, the protocol states that companies moving goods from Northern Ireland to Great Britain (England, Scotland and Wales) would have to fill out export declaration forms.
But the government's Internal Market Bill would give ministers the right to overrule or ignore this part of EU customs law.
Another part of the protocol says the UK has to follow EU rules on state aid - the financial support governments give to businesses - for goods related to Northern Ireland.
But the Internal Market Bill would give ministers power to interpret what that means and says this should not be done in accordance with the case law of the European Court of Justice.
The EU said this was trying to change parts of a recently-agreed international treaty unilaterally.
And when the legislation was first published, US President-elect Joe Biden warned that the Good Friday peace agreement in Northern Ireland "cannot become a casualty of Brexit".
But on 8 December, the UK and EU announced an "an agreement in principle" on issues including border control posts, the supply of food and medicines and clarification around state aid in Northern Ireland.
As a result, the government said it would drop the controversial clauses in the bill.
Taxation Bill
The Internal Market Bill only deals with trade from Northern Ireland to Great Britain, but the debate about goods moving in the opposite direction is equally sensitive.
The protocol says the joint committee is supposed to determine which goods moving from Great Britain to Northern Ireland are "at risk" of being exported over the Irish border to the EU and should therefore have tariffs - taxes on imports - imposed on them.
If there was no agreement between the two sides, then the default position would be tariffs paid on all goods.
The UK had plans, due to be introduced in a Taxation Bill, to allow UK ministers to make unilateral decisions on which goods could be deemed as "at risk" - after 1 January.
But, as a result of the "agreement in principle" - the government says these measures won't now be introduced.