Anti-Brexit campaigners are considering launching a legal bid to stop the UK government from putting its proposed withdrawal agreement before Parliament.
They believe it contravenes legislation preventing Northern Ireland forming part of a separate customs territory to Great Britain.
MPs are due to debate the agreement at a special Commons sitting on Saturday.
Campaigner Jo Maugham QC initially announced plans to petition Scotland’s highest civil court on Thursday.
He later tweeted to say he would “pause and reflect and take soundings from those I trust” before going to court at 12:00.
If Mr Maugham goes ahead with the legal challenge, he expects it to be heard at the Court of Session in Edinburgh on Friday.
Reports suggest a border in the Irish Sea with differing customs arrangements for Northern Ireland than elsewhere in the UK may form part of the withdrawal agreement.
However, a government source has told the BBC there will be “no deal tonight”, as officials continue to work on the technical details in Brussels.
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.
Mr Maugham initially tweeted: “I intend to lodge an immediate petition for an injunction in the Court of Session preventing the government from placing the withdrawal agreement before Parliament for approval.
“We expect that petition to be lodged tomorrow and to be heard on Friday.
“We believe the government’s proposed withdrawal agreement is contrary to Section 55 of the Taxation (Cross-border Trade) Act 2018.”
That part of the act states: “It shall be unlawful for Her Majesty’s Government to enter into arrangements under which Northern Ireland forms part of a separate customs territory to Great Britain.”
Mr Maugham added: “We do not understand how the government might have come to negotiate a withdrawal agreement in terms that breach amendments tabled by its own European Research Group.
“Unless and until Section 55 is repealed by the UK Parliament it is simply not open, as a matter of law, for the United Kingdom to enter into such an agreement.
“If the proposed withdrawal agreement is unlawful, the government will be obliged to request an extension as mandated by the Benn Act and in accordance with undertakings given to the Court of Session in Vince, Maugham, Cherry v Boris Johnson.”
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.