THE stand-off between Edinburgh and London over Brexit and devolved powers is “reaching the end game”, Nicola Sturgeon has said.

The First Minister said it was a matter of “days rather than weeks” before a constitutional dispute that has been simmering for more than a year comes to a head.

She said she hoped the Scottish and UK governments could still agree changes to the EU Withdrawal Bill at Westminster, and that there had been some recent progress.

However she said there remained “fundamental issues of principle” and suggested the bar for reaching an agreement would be high.

She also said London’s “deeply regrettable” decision to challenge Holyrood’s alternative Brexit bill at the Supreme Court would affect “the spirit” of negotiations.

The two governments are at odds over where around 110 powers in devolved areas exercised in Brussels should lie when they are repatriated to the UK in 2019.

UK government challenges devolved Brexit legislation

The UK government wants most to go to Holyrood, but says two dozen must be ring-fenced temporarily at Westminster to create UK frameworks to protect the internal market.

Ms Sturgeon says that is a “power grab”, and wants all powers devolved, as per the devolution settlement, or for frameworks to be created by consent, not imposed.

With Holyrood refusing to give legislative consent to the EU Withdrawal Bill, MSPs last month voted 92-32 for a rival Continuity Bill to bring all devolved law to Holyrood after Brexit.

If the two governments agree on how to amend the Withdrawal Bill - probably by April 30 - the Continuity Bill will be axed.

If not, the scene is set for the worst constitutional crisis since devolution began 20 years ago.

Scottish Secretary David Mundell has predicted the talks will “go to the wire”.

Court battle looms as Holyrood passes alternative Brexit Bill

Appearing before the conveners of Holyrood’s various committees, Ms Sturgeon was asked for an update on the process.

Referring to the UK Supreme Court referral, she said: “The Westminster government had a decision to make, whether to respect the decision the Scottish Parliament arrived at or not to respect it, and unfortunately they opted not to and referred to the Supreme Court.”

She said time was running out to reach an agreement on the EU Withdrawal Bill.

She said: “I think it's fair to say we are reaching the end game of this. We know the stage the withdrawal bill is at in terms of being at the report stage in the Lords, so we will probably over the next couple of weeks need to see this come to an agreement or not.

"We are talking now more like days rather than weeks."

Speaking on BBC Radio Scotland, Mr Mundell said: "I'm afraid the discussions and negotiations will go right up to the wire, but I am confident that we can reach an agreement."

He added: "The court referral is about seeking clarity, seeking certainty when different views have been expressed. It costs £200 to refer the case to the court. Obviously, if the case became involved in a protracted discussion there is greater cost.”

Tom Gordon: SNP stands to benefit long-term from Brexit Bill fallout

At Westminster, UK Attorney General Jeremy Wright said the Scottish and Welsh continuity Bills raised “serious questions about legislative competence that need to be explored”.

He told MPs that if they became law “there would be impacts not just on the governments and legislatures but on widespread understanding of and confidence in UK law after exit”.

SNP MP Joanna Cherry described the UK Government's action as “unprecedented”.

She asked: “Why is this Tory Government seeking to defeat a Bill in the courts which it couldn't defeat by democratic means in the Scottish Parliament?”

Devolution overhaul essential because of Brexit, experts warn

Scots Tory MP Kirstene Hair accused the SNP of manufacturing a legal row over Brexit with the Continuity Bill in order to push for another independence referendum.

She said: “It's time for the SNP to put this grievance to one side and get serious about working together as one team for the best possible Brexit."

SNP MP Pete Wishart said the challenge to the Bill showed “utter contempt” for Holyrood.