Scotland’s highest civil court has begun considering a legal bid to stop the UK government from passing its proposed EU withdrawal agreement.
Anti-Brexit campaigners believe it contravenes legislation preventing Northern Ireland from forming part of a separate customs territory.
Campaigner Jo Maugham QC lodged the petition at the Court of Session in Edinburgh on Thursday.
MPs are due to debate the agreement at a special Commons sitting on Saturday.
Mr Maugham wants an interdict effectively suspending the deal.
He is also demanding a court order so if MPs vote on the deal, the full, final text is put before them.
Lord Pentland is hearing the arguments on Friday morning.
Mr Maugham lodged the petition just hours after the announcement by Prime Minister Boris Johnson and European Commission President Jean-Claude Juncker that the two sides had come to an agreement on a deal for Brexit, ahead of a crucial EU summit in Brussels.
Speaking outside the Court of Session, Mr Maugham said: “We think in order to set a really important precedent going forward about the fact the government is subject to parliament control.
“We need the courts today to say what is obviously true, which is that Northern Ireland will be in a separate customs arrangement.”
Mr Johnson tweeted that the new withdrawal agreement “takes back control” and removes the “anti-democratic” Irish backstop, although the Tories’ Northern Irish allies in the DUP have indicated they cannot support the deal.
Meanwhile the SNP’s Ian Blackford has tabled an amendment rejecting the deal and calling for a three-month extension to allow for an early election.
EU chief negotiator Michel Barnier revealed the deal means Northern Ireland will remain in the UK’s customs territory but that the island of Ireland will be aligned to some EU rules, meaning goods must be checked on entry to the island rather than border checks between Northern Ireland and the Republic.
Mr Barnier said: “We are fully committed to protecting peace, to protect stability on the island of Ireland,” adding that a hard border would be avoided while protecting the integrity of the single market.
Explaining his legal objections to the agreement, Mr Maugham said it contravenes legislation stating it is “unlawful for Her Majesty’s Government to enter into arrangements under which Northern Ireland forms part of a separate customs territory to Great Britain”.
Under the current law, Section 55 of the Taxation (Cross-border Trade) Act 2018 prevents Northern Ireland from having difference customs rules than the rest of the UK.
This is purportedly to “uphold the constitutional integrity of the United Kingdom and safeguard the Union for the future”, according to a government briefing on the Bill.
This part of the Act was put forward by the Conservatives’ right-wing group of MPs known as the European Research Group (ERG).
Mr Maugham claims that if the court finds the proposed agreement is unlawful the government would be obliged to request an extension to Brexit negotiations, under the terms of the Benn Act.
That legislation stipulates the prime minister must ask the EU for a delay if Parliament does not agree a deal by Saturday.
The QC added: “Here we are, after three and a half years, and it looks as though Parliament will be asked to approve on Saturday a 500+ page document which it has not seen (indeed which does not yet exist) with epochal consequences for Great Britain, Northern Ireland and the EU and in short time.
“If the government wants to seek Parliament’s consent to repeal section 55, it can and should seek that consent.
“But it must not negotiate unlawful trade deals and then present them to Parliament as a fait accompli.”
Mr Maugham also argued the government will prevent Parliament from having any say on future trade negotiations, “including those affecting the NHS”.
He added: “That should cause deep alarm to all of us.”
Mr Maugham was involved in the legal fight against Boris Johnson’s decision to suspend parliament for five weeks – a move that was ruled unlawful by the Supreme Court.
He was also part of the team that wants the Court of Session to rule on whether it could use a special power called nobile officium to sign letter requesting an extension to the Brexit process on behalf of the government.