The Supreme Court is to rule on the Scottish government's plans for an independence referendum after Nicola Sturgeon set out plans to hold a vote in October 2023. What are the key arguments likely to be heard in court, and will they decide the fate of indyref2 once and for all?
Why is this going to court?
In short, something needs to happen to break the deadlock between the Scottish and UK governments on independence.
The first minister wants to hold a fresh vote, has a pro-independence majority at Holyrood and indeed has named a date. But successive prime ministers have insisted that "now is not the time".
This means a transfer of power like the one which underpinned the 2014 vote is not forthcoming - so Ms Sturgeon wants judges to rule on whether MSPs could set one up without Westminster's backing.
There has been a long-standing debate over whether passing a referendum bill would be within Holyrood's powers, and the Scottish government's chief legal adviser - the Lord Advocate, Dorothy Bain QC - has referred the issue to the Supreme Court.
In truth this may have been the only way forward, because Ms Bain said she would not sign off a referendum bill to be tabled by Scottish ministers until the question of legal competence was settled.
Two days of arguments will be heard from 11 October, with a judgement expected to follow some months later.
What is the case for Holyrood having the power?
The Scotland Act states that it would be outwith Holyrood's competence to make provisions which "relate to reserved matters" - the reserved matter in question here being the Union of the Kingdoms of Scotland and England.
It may seem silly to ponder whether an independence referendum bill relates to the Union. How could it not? However, there are a number of technical points to dive into here.
There is a school of thought that the bare fact of holding a referendum seeking people's views about independence would not in itself actually break up the union.
Nicola Sturgeon told MSPs that the referendum would be "consultative, not self-executing" - explaining that this meant that "a majority yes vote in this referendum will not in and of itself make Scotland independent".
Legislation would need to be passed at Westminster and Holyrood to actually make independence a reality - and thus technically, in pure legal terms, the act of asking the electorate about it is a separate issue.
Ms Sturgeon points to the Brexit referendum as an example. The 2016 vote didn't drop the UK out of the EU automatically, but rather sparked years of negotiations and legislative wrangling which resulted in a rather gradual break-up.
Some have also pointed to the Brexit court case brought by Gina Miller in 2017, where judges opined that the 2016 referendum "did not change the law in a way which would allow ministers to withdraw the UK from the EU without legislation".
They said the referendum was "of great political significance" and was "in no way devoid of effect", but that "unless and until acted on by parliament, its force is political rather than legal".
There is a nod to this argument in the first paragraph of the draft bill which judges will consider. It specifically says the purpose of the bill is to "ascertain the views of the people of Scotland on whether Scotland should be an independent country".
This is what Ms Sturgeon means when she says it would be a "consultative" vote - but she says the same was true of those in 2014 and 2016.
Ms Bain's written case essentially puts this into legalese, arguing that "the bill would not purport to alter or impede any legal rule constituting or affecting the union", adding that "the legal consequences of the bill are, relevantly, nil".
The SNP is also looking to intervene in the case as a separate player to make some more political points about the right to self-determination, although it is yet to be seen whether judges will allow this.
What is will the UK government's counter-argument be?
To start with, the UK government side argue that judges shouldn't make a ruling at all, saying it is premature to consider a bill before it has passed through parliament. What if the court were to sign off the existing draft, only for MSPs to later amend it?
It is still possible that the court could agree with this, but judges want to hear the substantive arguments at the same time as those over this technical point.
UK law officers are yet to submit their written case, but have made their position on the central point clear - that the constitution is reserved to Westminster.
This is loose language legally, given the UK does not have a written constitution and the Scotland Act specifically reserves the Union itself.
But it is broadly the point UK law officers will pursue - that Westminster is the sovereign parliament, and that it has reserved the powers in this area. Holyrood's powers, meanwhile, are specifically limited by the Scotland Act.
In fact they advanced these very lines of argument recently in response to a citizen legal challenge at the Court of Session in 2021. That case was ultimately thrown out as being "premature", but provided a reasonable insight into some of the arguments we may hear.
The UK government side point to previous rulings which suggested that in order to "relate to" a reserved matter, a Holyrood bill must have "more than a loose or consequential connection" with it - and that a referendum bill would clearly meet this test.
They said that even beyond legal effect, legislation authorising a referendum would "seek to build momentum towards achieving independence" and the breakup of the UK.
They also argued that Scotland leaving the UK would impact directly on the powers of the UK parliament - something MSPs are also not meant to do.
And they cited statements made by ministers during the passage of the Scotland Act in 1998 - including Scottish Secretary and future first minister Donald Dewar's claim that "a referendum that purported to be ultra vires [beyond Holyrood's powers] is in itself ultra vires".
Ms Bain's written argument also summarises the case against Holyrood having the powers, and suggests a couple of other lines.
It notes that the SNP's manifesto commitment to a referendum stressed that the vote "must be capable of bringing about independence" - clearly indicating that they intend the bill to lead to the breakup of the UK.
And it puts a different emphasis on the ruling from the Gina Miller case mentioned above, highlighting the phrasing that referendum results are "in no way devoid of effect".
Will the ruling settle the question of indyref2?
It would be foolish to speculate about how the judges will assess these arguments, for all there has been much academic chin-stroking about how they have viewed the boundaries of devolved competence in previous cases.
Scotland's top judge, Lord Carloway, also hinted that it "may not be too difficult to arrive at a conclusion" when declining to rule on the citizen-led case mentioned above.
The current president of the court, Lord Reed, and his deputy Lord Hodge, are both Scottish and indeed former Court of Session judges. They will be well versed in the matter of devolution, and have stressed the paramount importance of judicial independence and impartiality.
In any case, the result of the case is not guaranteed to settle whether or not there is a vote in October 2023.
For example, should the Scottish government lose, they are not going to pack up and go home. In fact they have threatened to double down by treating the next general election as a "de facto referendum".
And equally, should the pro-union side lose, it wouldn't necessarily stop them arguing that this is not the best time for a referendum. It would put tremendous pressure on them, but they could argue that just because you can have a vote doesn't mean you should.
That pressure is really the point here. Ms Sturgeon still really wants to win an agreement with the UK government.
Her goal, of a legitimate referendum that wins international recognition and can actually deliver independence, is best served by a gold-standard process with both sides taking part in good faith.
So no matter what the result is in court, the search for a political solution is likely to continue.
Do you have a question about Scottish independence? Use the form below to send it to us and we could be in touch.
In some cases your question will be published, displaying your name, age and location as you provide it, unless you state otherwise. Your contact details will never be published. Please ensure you have read the terms and conditions.
If you are reading this page on the BBC News app, you will need to visit the mobile version of the BBC website to submit your question on this topic.