The Supreme Court is set to decide whether a second Scottish independence referendum can take place without Westminster's approval.
The matter has had to be referred to the UK's highest court as the Scottish government argues a referendum would fall within its devolved powers, but the UK government says it holds the final say.
After a two-day hearing in October, the Supreme Court will deliver its judgment on Wednesday morning.
Wasn't there a referendum already?
In September 2014, a Scottish independence referendum was held, with 55.3% voting against independence and 44.7% voting for it.
It was carried out after David Cameron granted the Scottish government the powers to hold a referendum after the Scottish National Party won a majority at Holyrood.
The Scottish government said at the time the vote was a "once in a generation opportunity".
However, ahead of the 2016 Brexit vote the SNP said a second independence referendum - dubbed "Indyref2" - should be held if there was a material change in circumstances, such as the UK leaving the EU.
Attempts to hold 'Indyref2'
In 2017, First Minister Nicola Sturgeon was given approval by the Scottish Parliament to seek a Section 30 Order under the Scotland Act 1998, which gives the nation its devolved powers, to hold another independence referendum "when the shape of the UK's Brexit deal will become clear".
A Section 30 Order can be used to increase or restrict - permanently or temporarily - the Scottish Parliament's legislative authority and was used to temporarily legislate for the first referendum.
But, Theresa May, who was prime minister in 2017, refused to grant the order, saying "now is not the time" and that the focus should be on getting the best Brexit deal for the whole of the UK.
In 2021, the SNP said if pro-independence parties won a majority in the Scottish parliament election that year the government would introduce a bill for an independence referendum.
The SNP and the Scottish Greens, who also support independence, won a majority and in 2022 Ms Sturgeon published a draft referendum bill that the Scottish government said would underwrite the referendum, if it was passed by the Scottish Parliament.
As part of the draft bill, she also announced plans to hold a referendum on 19 October 2023 after Boris Johnson rejected her request to hold one in July 2022.
Why is the decision now with the Supreme Court?
As Westminster has refused to grant a Section 30 Order, and therefore to give Scotland the power to hold a second referendum, is unclear whether the Scottish government has the power to pass the referendum bill without it.
Because of this, Ms Sturgeon in June said Scotland's Lord Advocate, Dorothy Bain, would ask the Supreme Court to rule on the legality of holding a vote without central approval.
Ms Sturgeon said if the court refuses to make a ruling, or it deems a referendum would not be legal, and the UK government continues to withhold its approval then the next general election would be a "de facto independence referendum".
Scotland could then, she said, become independent if a majority of votes go to pro-independence parties.
However, the Lord Advocate, who is also the Scottish government's chief legal adviser, said she did "not have the necessary degree of confidence" the Scottish government would have the power to hold a referendum off its own back.
As the UK government would likely challenge the referendum bill in court, if the Scottish Parliament passed it, Ms Sturgeon has sought to pre-empt that challenge by asking the Supreme Court to decide instead.
What are the Supreme Court's options?
The court's judges heard arguments on 11 and 12 October and had more than 8,000 pages of written material to consider.
Ms Bain told the court a referendum would be "advisory" and would have no legal effect on the union, arguing the draft referendum bill would be objectively neutral.
But Sir James Eadie KC, the UK government's independent barrister, said it was "obvious" the bill related to reserved matters and the union.
He said that was outside the devolved competence of the Scottish Parliament and argued the Supreme Court should not rule at all on the case.
There are four possible outcomes: judges refuse to rule either way; they let the Scottish Parliament pass a referendum bill; they block Scottish Parliament from doing so.
Another option is the court could say they are unable to provide a judgment because the Lord Advocate does not have the powers to refer the referendum bill to the Supreme Court but, as they did with a challenge over abortion in Northern Ireland in 2017, they could provide an answer based on if the Lord Advocate did have that power.
If there is no ruling either way, as the UK government has been arguing for, this will leave Scottish ministers in limbo.
And if they do rule the draft bill can be voted on, that would provide the legal basis for holding a referendum. But there would still need to be a political settlement between Scotland and Westminster over whether a vote should be held next October.