The Scottish Government's most senior law officer has insisted Scotland's Brexit continuity Bill is compatible with EU law despite Holyrood's presiding officer ruling the opposite.
Lord Advocate James Wolffe QC told MSPs the legislation, published on Tuesday, was within the legislative competence of the Scottish Parliament, contradicting the view given by Ken Macintosh.
The Bill has been introduced by Scottish ministers as an alternative to the UK Government's EU Withdrawal Bill amid an ongoing dispute over what devolved administrations have branded a "power grab" under the Westminster legislation.
Mr Wolffe said that in his view if the Scottish Government's legislation was incompatible with EU law, then the same would apply to the UK Government's Bill.
The Lord Advocate thanked Mr Macintosh for his "careful and serious" consideration of the matter, emphasising that in disagreeing with his conclusions he was not expressing any personal criticism.
But he added: "The government is and remains satisfied that this Bill is within the legislative competence of the parliament."
The key legal issue centres around whether the continuity Bill would be compatible with EU law when enacted, as required by the Scotland Act 1998, with Mr Macintosh believing that it would not.
Mr Wolffe said: "The legal obligation on ministers to comply with EU law will endure until the UK leaves the EU. This Bill does not change that obligation.
"Ministers will continue to be subject to legal requirements to transpose, implement and otherwise abide by EU law so long as the UK remains a member of the EU. This Bill does not alter those requirements.
"The Bill does nothing which will alter European Union law or which undermines the scheme of EU law while the UK remains a member of the EU.
"What the Bill does is to make provision for the continuity of the law immediately upon and following withdrawal from the EU."
He added: "It is not incompatible with EU law to make provision to deal with the inevitable consequences in domestic law of withdrawal from the EU in this way.
"Indeed that appears to be the basis upon which the UK Government's own EU Withdrawal Bill, upon which this Bill has been modelled, proceeds.
"If that is right and if contrary to the view of the Scottish Government this Bill is incompatible with EU law then the same reasoning would apply equally to the UK Government's Bill."
Tory MSP Adam Tomkins said: "It is true as the Lord Advocate has said that the Bill is carefully drafted to ensure that provisions that would be contrary to EU law will not come into force until after exit day but this consideration goes to their legal effect in the future not to their legal validity now.
"On the question of competence, when it comes to compatibility with EU law, is a matter of legal validity not future or anticipated legal effect.
"This is the critical point of legal analysis on which the presiding officer relies. I think it's correct."
Labour's Neil Findlay urged the Scottish Government to get back round the table with the UK Government to resolve the issues with the Withdrawal Bill.
"We want to see a workable and competent Bill presented and will work with others for a solution to this situation."
Greens co-convener Patrick Harvie said the parliament was facing "extraordinary circumstances which neither this parliament nor the people we represent have chosen to face".