The EU is demanding the UK ditches plans to change Boris Johnson’s Brexit deal “by the end of the month” or risk jeopardising trade talks.
The UK has published a bill to rewrite parts of the withdrawal agreement it signed in January.
The EU said this had “seriously damaged trust” and the EU would not be “shy” of using legal action against the UK.
But cabinet minister Michael Gove said the UK had made it “perfectly clear” it would not withdraw the bill.
The government says Parliament is sovereign and it can pass laws which breach the UK’s international treaty obligations.
Meanwhile, trade talks between UK and EU officials continue in London.
The source of the EU’s concern is Mr Johnson’s proposed Internal Market Bill, which was published on Wednesday.
It addresses the Northern Ireland Protocol – an element of the withdrawal agreement designed to prevent a hard border returning to the island of Ireland.
The bill proposes no new checks on goods moving from Northern Ireland to Great Britain. It gives UK ministers powers to modify or “disapply” rules relating to the movement of goods that will come into force from 1 January, if the UK and EU are unable to strike a trade deal.
The publication of the bill prompted emergency talks between Cabinet Office minister Michael Gove and Maros Šefčovič, the European Commission Vice-President.
By Nick Beake, BBC News Brussels
The EU couldn’t quite believe what it was hearing when the UK confessed its draft bill would break international law. But now, after one of its top officials met Michael Gove in London, it has been left in no doubt.
Cue a blistering statement from the European Commission setting a hard deadline for Boris Johnson to perform a U-turn or face legal action.
Perhaps the most withering criticism came in response to the prime minister’s claim that a key aim of the bill was to ensure peace in Northern Ireland.
It would have the opposite effect, the EU declared. A short distance away from the fraught Gove/Šefčovič meeting, the troubled trade talks went on.
And they do not look good, with the two sides seemingly poles apart.
Following the discussions, the EU issued a strongly-worded statement warning that the withdrawal agreement was a legal obligation, adding that “neither the EU nor the UK can unilaterally change, clarify, amend, interpret, disregard or disapply the agreement”.
The EU rejected the UK’s arguments that the bill is designed to protect peace in Northern Ireland arguing that “it does the opposite”.
Mr Šefčovič said that if the bill were to be adopted, it would constitute an “extremely serious violation” of the withdrawal agreement and of international law.
He urged the government to withdraw the bill “by the end of the month”, adding that the withdrawal agreement “contains a number of mechanisms and legal remedies to address violations of the legal obligations contained in the text – which the European Union will not be shy in using”.
In its response, the UK government said it would “discharge its treaty obligations in good faith”, but added that “in the difficult and highly exceptional circumstances in which we find ourselves, it is important to remember the fundamental principle of parliamentary sovereignty”.
“Parliament is sovereign as a matter of domestic law and can pass legislation which is in breach of the UK’s treaty obligations. Parliament would not be acting unconstitutionally in enacting such legislation.
“Treaty obligations only become binding to the extent that they are enshrined in domestic legislation. Whether to enact or repeal legislation, and the content of that legislation, is for Parliament and Parliament alone.”
Mr Gove “said that, during the talks, he had “made it perfectly clear that we would not be withdrawing this legislation”, adding that the government was “absolutely serious”.
The Internal Market Bill will be formally debated by MPs in Parliament for the first time on Monday, 14 September.
Amid criticism from Labour and several senior Conservatives, Mr Gove said: “I’m looking forward to the second reading of the bill next week. It’s an opportunity for the government to set out in detail why we have this legislation.”
He promised to fight for “unfettered access for good from Northern Ireland to the rest of the United Kingdom”.
Mr Johnson has defended the bill, saying it would “ensure the integrity of the UK internal market” and hand power to Scotland and Wales, while protecting the Northern Ireland peace process.
But critics say the move will damage the UK’s international reputation after a minister admitted the plans break international law.
Labour leader Sir Keir Starmer urged the government to consider “the reputational risk that it’s taking in the proposed way forward”.
Meanwhile, the chief negotiators from the UK and the EU, Lord David Frost and Michel Barnier, are meeting face-to-face in separate talks to help break the deadlock on negotiations for a future trade deal.
This latest round of negotiations is due to conclude on Thursday, and the UK government has said it is prepared to walk away if progress is not made soon.