Agreement has been reached on how to implement Northern Ireland aspects of Brexit involving borders and trade, the EU and UK said.

The British Government confirmed it will withdraw controversial measures which could have seen the divorce deal torn up and the UK break international law.

The agreement covers issues like border checks on animal and plant products, the supply of medicines and deliveries of chilled meats and other food products to supermarkets.

There was also “clarification” on the application of rules on state subsidies.

Stormont First Minister Arlene Foster said: “For us the important issue on all of these matters is that we have unfettered access from Northern Ireland into Great Britain, but also that trade from Great Britain into Northern Ireland can trade freely as well, so we await to see what has happened in relation to those matters.”

It follows progress in talks led by Cabinet Office minister Michael Gove and Maros Sefcovic from the European Commission.

They co-chair the EU-UK Joint Committee, which oversees the implementation of the Withdrawal Agreement and Northern Ireland Protocol.

In a joint statement, the UK and EU said “an agreement in principle” had been reached on all issues.

In view of these “mutually agreed solutions”, the UK Government will withdraw clauses 44, 45 and 47 of the UK Internal Market Bill – which could have overridden the Withdrawal Agreement – and will not introduce any similar provisions in the Taxation Bill.

The statement said: “Following intensive and constructive work over the past weeks by the EU and the UK, the two co-chairs can now announce their agreement in principle on all issues, in particular with regard to the protocol on Ireland and Northern Ireland.”

The announcement was separate from ongoing trade talks.

The protocol is due to come into effect from the start of next year and would keep Northern Ireland in line with some EU regulations on the single market to allow an open border and free flow of goods and services across the island.

Mr Gove, who will give further details during a statement to Parliament on Wednesday, said that businesses in Northern Ireland will have the “best of both worlds”.

He told reporters: “We’ve made sure, that working with the Northern Ireland executive, there will be a small number of proportionate checks on food products when they go into Northern Ireland.

“The good news is that alongside those minimal checks we’ve been able to remove many of the other concerns that businesses in Northern Ireland had about the protocol.

“That means that businesses in Northern Ireland have the opportunity to enjoy the best of both worlds: access to the European single market, because there’s no infrastructure on the island of Ireland, and at the same time unfettered access to the rest of the UK market.”

Westminster was understood to have resisted EU calls for a permanent office in Belfast, but will allow the bloc to station officials there.

A UK Government source said: “The EU sought a ‘mini embassy’. They withdrew that request. The EU do have the right under the Protocol to supervise processes conducted by UK authorities, which we will of course support, but there will be no mini-embassy, no mission, no building with a flag or brass.”

Meanwhile, Irish Foreign Affairs Minister Simon Coveney said the agreement was positive news.

He said: “Of particular significance is the commitment by the UK to withdraw clauses 44, 45 and 47 of the Internal Market Bill, bringing it back into line with its obligations under the Withdrawal Agreement.”

The Bill had prompted the the EU to launch legal action against the UK during an increasingly acrimonious row.

It could have allowed ministers to override the UK’s EU Withdrawal Agreement as it contained measures relating to the way trade will be done between Northern Ireland and Great Britain.

The protocol says companies moving goods from Northern Ireland to Great Britain would have to fill out export declaration forms.

The Internal Market Bill would have given ministers the right to overrule this part of EU customs law.

Mr Coveney said: “This positive development comes after significant and productive engagement between the EU and the UK on implementation of the protocol, as provided for under the Withdrawal Agreement.

“I hope this may also provide some of the positive momentum necessary to instil confidence and trust and allow progress in the wider context of the future relationship negotiations.”

Aodhan Connolly, director of the Northern Ireland Retail Consortium, which represents larger businesses, said it was a hugely positive development but businesses will need the technical detail as soon as possible.

“Even more than the detail, we will need to see that they work and enable the retail industry to continue to provide the people of Northern Ireland the choice and affordability that they desperately need.”