A judge at Scotland’s highest civil court is considering a legal bid to stop the UK government from passing its proposed EU withdrawal agreement.
Anti-Brexit campaigners believe the deal contravenes legislation preventing Northern Ireland from forming part of a separate customs territory.
The UK government said the court should not stop the matter coming before Parliament.
MPs are due to debate the agreement at a special Commons sitting on Saturday.
Lord Pentland, who heard the legal arguments on Friday morning, said he hoped to deliver his decision by 17:00.
The petition was lodged at the Outer House of the Court of Session in Edinburgh on Thursday by campaigner Jo Maugham QC.
What is the case about?
Mr Maugham believes the new withdrawal agreement is unlawful.
He says 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”.
Section 55 of the Taxation (Cross-border Trade) Act 2018 prevents Northern Ireland from having different customs rules than the rest of the UK.
Mr Maugham wants an interdict effectively suspending the deal.
He 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.
Mr Maugham is also demanding a court order so if MPs vote on the deal, the full, final text is put before them.
He is also concerned that the government will prevent Parliament from having any say on future trade negotiations, “including those affecting the NHS”.
The petition has been opposed by the UK government.
On Friday Mr Maugham’s lawyer, Aidan O’Neill QC, argued that there was as yet “no concluded withdrawal agreement in EU law” and described it as “a void agreement”.
He said the legal reality of the deal was that Northern Ireland would be part of the EU customs territory. Mr O’Neill said this was in breach of UK law, and that the agreement represented an “unlawful action on the part of the UK government.”
Lord Pentland asked the QC if his request for a court order would stop debate in Parliament on Saturday, and said he was concerned that suspending the withdrawal agreement would mean the courts becoming heavily involved in Parliament’s business.
Mr O’Neill said the order would not stop the debate, and insisted they were purely calling for the agreement to be declared void on grounds of being unlawful.
The UK government’s lawyer, Gerry Moynihan QC, put forward a letter written by lawyers on behalf of Commons Speaker John Bercow.
He said the letter insisted that the court “should not make any order which would inhibit the bringing of any matter before Parliament”.
He said the government’s proposals did not breach international trade laws and he urged Lord Pentland to dismiss the action.
Speaking outside the Court of Session before the case, 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 has said 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 has said that 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.
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.