The Scottish government's top lawyer was not prepared to sign off on an independence referendum bill, court papers have revealed.
Lord Advocate Dorothy Bain has asked the Supreme Court to rule on whether Holyrood has the power to legislate for a vote without UK government consent.
She said she currently "does not have the necessary degree of confidence" that it does.
Nicola Sturgeon has said she wants to hold a referendum on 19 October 2023.
The Lord Advocate is still expected to argue the Scottish government's case at the Supreme Court, and she said there was an issue of "exceptional public importance" for judges to resolve.
Ms Sturgeon still hopes to win the agreement of UK ministers for a fresh referendum, but had asked the Lord Advocate to refer the matter to the Supreme Court for a ruling on whether one could go ahead without the backing of Westminster.
She told MSPs that this would "accelerate to the point when we have legal clarity and legal fact".
However, papers lodged with the court suggest that the Lord Advocate would not have backed ministers in tabling a referendum bill while the question of whether Holyrood has the powers to do so remained unresolved.
All bills must be accompanied by a statement underlining that they are within the legislative competence of the Scottish Parliament, which must be cleared by the Lord Advocate.
The reference to the Supreme Court said that in the case of a referendum bill, "the Lord Advocate does not have the necessary degree of confidence" to do this.
Instead, it said that Ms Bain "considers there is a genuine issue of law that is unresolved", and this is of "exceptional public importance to the people of Scotland".
She also said that the matter was directly relevant to a key manifesto pledge which she said had been endorsed by the Scottish public, with the SNP and Greens holding a majority of the seats at Holyrood.
Ms Bain wrote: "The Scottish government, the Scottish Parliament and the people of Scotland and the wider United Kingdom ought to have clarity on the scope of the relevant reservations on this issue of fundamental constitutional importance.
"Being questions of law, only this court can provide that clarity and unless the issue is judicially resolved there will remain uncertainty and scope for argument about the powers of the Scottish Parliament. That is not in the best interests of the people of Scotland or of the United Kingdom."
Ms Bain will submit a written note of argument to the court, while the UK government will be asked to respond. The Welsh and Northern Irish administrations have also been notified.
Handling of the case is currently with the president of the court, Lord Reed - a Scottish former Court of Session judge. He will decide the timescales on which the case will be heard, and whether any preliminary issues need to be dealt with first.
If the Scottish government wins the case, Ms Sturgeon said the bill would be introduced at Holyrood and passed swiftly to allow a vote to happen in October 2023.
However if judges rule against this, the first minister said the SNP would treat the next UK general election as a "de facto referendum" and seek to use the result to trigger independence negotiations.
It was the centrepiece of Nicola Sturgeon's big referendum announcement - the Supreme Court would be asked to settle once and for all the long-standing question of Holyrood's powers.
The tactic of having the Lord Advocate push the matter to the courts immediately was an innovative one which caught Holyrood's opposition parties and indeed the UK government on the hop.
However, it appears the first minister actually had little choice. Her previous strategy was to pass the bill, then defend it in court against an inevitable challenge, but these papers show that the Lord Advocate would not have signed off on the key first step in that plan.
It may make little difference in the grand scheme of things. We are still going to court, and the Lord Advocate is still arguing the case for MSPs having the power to legislate for indyref2.
But this illustrates the narrow room for manoeuvre the first minister has on this issue - and the potential difficulty of winning over the judges of the Supreme Court.
Opposition MSPs had pressed for Ms Bain to give a statement to parliament following Ms Sturgeon's announcement, but this did not happen before Holyrood's summer recess.
The UK government remains opposed to a referendum with Deputy Prime Minister Dominic Raab saying on Tuesday that the position has not changed.
He told MPs: "We do not think that now is the right time for a second referendum, given all the pressures and challenges and given the outcome of the first.
"I think what the people of Scotland want to see is both their governments - in Edinburgh and in Westminster - working closely together."
Scottish Conservative constitution spokesman Donald Cameron claimed that the papers that had been sent to the Supreme Court showed that the SNP was "playing political games by going to court in order to stir up grievance."
He added: "Now we know why the Scottish government, shamefully, failed to allow the Lord Advocate to appear before Parliament last week, ahead of the summer recess - because Scotland's top law officer is not confident that the First Minister's plan to hold a divisive and unwanted referendum has any legal basis."
Scottish Labour MSP Sarah Boyack said: "It is clear from the document that the Lord Advocate does not have confidence that what the SNP is proposing is legal.
"With the country in the midst of a cost of living crisis, it is deeply disappointing to see Nicola Sturgeon return to the politics of the past."