The UK cannot unilaterally set aside the Brexit Withdrawal Agreement signed by Boris Johnson, European Commission president Ursula von der Leyen has warned.
In her annual State of the Union address to the European Parliament, Mrs von der Leyen said both sides had agreed it was the only way to guarantee the Northern Ireland peace process.
She said trust would be undermined if the UK started to go back on its international treaty obligations.
The warning came after the Government issued legislation enabling ministers to override provisions in the Withdrawal Agreement relating to Northern Ireland.
Mr Johnson has insisted it is intended to provide a legal "safety net" to protect the peace process and ensure the EU could not impose tariffs on goods moving to Northern Ireland from the rest of the UK.
Addressing the Parliament in Brussels, Mrs von der Leyen said: "This Withdrawal Agreement took three years to negotiate and we worked relentlessly on it line-by-line, word-by-word, and together we succeeded.
"The European Union and the UK jointly agreed that it was the best and only way for ensuring peace on the island of Ireland and we will never backtrack on that.
"This agreement has been ratified by this house and the House of Commons. It cannot be unilaterally changed, disregarded, disapplied.
"This is a matter of law and trust and good faith."
Mrs von der Leyen said Margaret Thatcher had always insisted the UK honoured its treaty commitments.
She quoted the former prime minister as saying: "Britain does not break treaties. It would be bad for Britain, bad for relations with the rest of the world and bad for any future treaty on trade."
Mrs von der Leyen added: "This was true then and this is true today. Trust is the foundation of any strong partnership."
Justice Secretary Robert Buckland said the provisions in the UK Internal Market Bill are only intended for use if the EU reneged on its treaty obligations.
"If we reach that stage, the reason for it is because we judge that sadly, despite everybody's best efforts, the EU is in a position where we think they are actually breaching their obligations to us," he told Sky News.
"I would like to avoid that, I think we can, but we do need to just prepare for that contingency, that 'break glass in case of emergency' provision, which I believe this is."
Mrs von der Leyen's intervention came as senior US congressional figures warned Mr Johnson they would not support any US free trade deal with the UK if he tried to "flout" the Northern Ireland protocol in the Withdrawal Agreement.
In a letter to the Prime Minister, four congressmen led by chairman of the House Foreign Affairs Committee Eliot Engel said they considered the issues of a trade deal and the Northern Ireland peace process to be "inextricably linked".
"With the issues raised in this letter in mind, we therefore urge you to abandon any and all legally questionable and unfair efforts to flout the Northern Ireland protocol of the Withdrawal Agreement and look to ensure that Brexit negotiations do not undermine the decades of progress to bring peace to Northern Ireland and future options for the bilateral relationship between our two countries," they wrote.
While negotiating a free trade agreement is a matter for President Donald Trump and the White House, it can only be implemented if it is approved by Congress.
The Speaker of the US House of Representatives, Nancy Pelosi, has previously warned that Congress would never pass a trade agreement it believed could "imperil" the Good Friday Agreement.
Ms Pelosi was due to meet Foreign Secretary Dominic Raab who was in Washington on Wednesday for talks with senior US figures, including Secretary of State Mike Pompeo.