The advice argues that the protocol contradicts the 1800 Articles of Union which united Great Britain and Ireland at the time of King George III.

The articles, which Mr Howe points out remain in force, state that "in all treaties with any foreign power, his Majesty's subjects of Ireland shall have the same privileges and be on the same footing as his Majesty's subjects of Great Britain".

They also stipulate that all prohibitions on the export of products of Great Britain to Northern Ireland or vice versa should cease from 1 January 1801.

What is the draft withdrawal agreement?

The 585-page document, which prompted two cabinet members to resign in mid-November, focuses on the terms of the UK's departure. It includes how much money the UK must pay to the EU as a settlement (often dubbed the divorce bill), details of the transition period and citizens' rights.

It also covers the so-called "backstop", a last-resort option to maintain an open border on the island of Ireland in the event the UK leaves the EU without securing a trade deal. It would avoid the need for bringing back physical border checks.

The backstop would involve a temporary single customs territory, encompassing Northern Ireland and the rest of the UK, effectively keeping the whole of the UK in the EU customs union - until both the EU and UK agree that it is no longer necessary.

Critics fear the UK would continue to follow EU rules for an indefinite time without having any say over them.

As well as the ministers who quit, others are believed to be trying to change the wording of the draft. There has been speculation over whether a confidence vote in Theresa May's leadership could be triggered.

The EU will consider the agreement, alongside a declaration on its future relations with the UK, at a summit on 25 November. But neither has yet been approved by Parliament.

The legal opinion points out that the Northern Ireland Act 1998 also contains a provision recognising the importance of the UK internal economic market.

Mr Howe acknowledged that as the EU Withdrawal Agreement may eventually become law it could repeal or override the 1800 and 1998 acts.

However, he argued that if this happens it would constitute an alteration to the constitutional status of Northern Ireland, relative to other parts of the UK.

Image copyrightGetty Images

The legal advice states that "making such an alteration to the constitutional status of Northern Ireland without Northern Ireland's consent would breach the UK government's obligations under the Belfast Agreement".

The barrister pointed out that the Irish government is also party to the Good Friday Agreement and maintains that "the present Irish government's support for this constitutional land grab by the EU breaches Ireland's solemn obligations to respect the constitutional status of Northern Ireland".

Whether or not the EU Withdrawal Agreement changes Northern Ireland's status or breaches the Good Friday Agreement's "principle of consent" has been a point of issue between the government and its critics.