The Scottish government has published its draft bill on a second independence referendum.
The move does not mean another referendum will definitely be held.
But First Minister Nicola Sturgeon said Scotland should be ready to hold a vote before the UK leaves the EU if it is felt necessary to protect Scottish interests.
UK Prime Minister Theresa May has said she does not believe there is a mandate for another referendum on independence.
If Scottish Ministers decide a referendum is necessary it would then be for the Scottish Parliament - where the SNP and Scottish Greens form a small pro-independence majority - to consider the bill and decide whether a vote should be held.
The UK government would then be asked to grant a Section 30 order to make the referendum legally binding.
The draft Referendum Bill was formally published by Constitution Secretary Derek Mackay, despite the Scottish Parliament being in recess until next week.
It says that any future referendum would be held on a similar basis to the one in 2014, which saw voters reject independence by 55% to 45%.
The draft bill also says that:
- It is currently expected that the same straight yes/no question would be used again - "Should Scotland be an independent country?"
- But the Scottish government reserves the right to submit a proposal for different wording to the Electoral Commission for independent testing
- 16 and 17 year-olds and citizens of EU countries who have made Scotland their home would again be able to vote
- The referendum would again not be subject to any minimum turnout requirement, and would be decided by a simple majority of voters
The proposals have now gone out for a public consultation, which will run until 11 January next year.
But pro-union opposition parties have already argued that there is no appetite in Scotland for another "divisive" referendum, and have pledged to fight it "every step of the way".
And a spokesman for the prime minister also dismissed the need for another independence vote, saying: "The prime minister and the government does not believe that there is a mandate for one.
"There was one only two years ago. There was an extremely high turnout and there was a resounding result in favour of Scotland remaining in the UK."
Asked if UK ministers would reject a call for a second referendum from the Scottish government, he stated: "There has not been a call."
Scotland voted by 62% to 38% to remain in the EU in June's referendum, but the UK as a whole voted to leave - with Ms Sturgeon immediately instructing Scottish government officials to start drawing up plans for a fresh vote on independence.
However, opinion polls have suggested there has not been a major upsurge in support for independence since the Brexit vote, with a narrow majority still in favour of Scotland remaining in the UK.
Some senior SNP figures have cautioned Ms Sturgeon against "rushing into" another independence referendum before she could be certain of winning it.
In her foreward to the consultation document, Ms Sturgeon said the Brexit vote meant "Scotland is now faced with one of the specific scenarios in which this government pledged that the Scottish Parliament should have the right to hold an independence referendum".
She added: "This government remains willing to work with the UK government to negotiate a future relationship with Europe that is in line with the views of the overwhelming majority of the Scottish people and which works for the United Kingdom as a whole.
"We will put forward constructive proposals that will both protect Scotland's interests and give an opportunity for the UK government to demonstrate that Scotland is indeed an equal partner.
"But if it becomes clear that it is only through independence that Scotland's interests can be protected, then the people of Scotland must have the ability to reconsider that question, and to do so before the UK leaves the EU."
Ms Sturgeon, who is expected to meet UK Prime Minister Theresa May in London on Monday, has said efforts to protect Scotland's place in Europe would intensify over the coming weeks.
She has said she will put forward specific proposals aimed at keeping Scotland in the single market even if the rest of the UK leaves.
And she will push for "substantial additional powers" for Holyrood as part of the UK's Article 50 negotiations, including over international deals with other nations and immigration.
Mrs May has said that all parts of the UK will leave the EU at the same time despite calls from the SNP for a separate arrangement to be agreed for Scotland.
But she has said she is "willing to listen to options" on Scotland's future relationship with the EU.
Responding to the draft bill's publication, Scottish Conservative leader Ruth Davidson said the Scottish government had "given up on being a government for all of Scotland and is just playing to the SNP choir".
She added: "The majority of folk don't want another vote, the majority of people in Scotland don't want independence, and the SNP should take this off the table.
"I don't think any of the questions that Brexit raises are answered by ripping Scotland out of our own union of nations - it is worth four times more in terms of trade.
"And I don't accept, when Nicola Sturgeon tells someone like me who voted to Remain, that my vote for Remain is somehow a proxy for independence."
'Politics of division'
Scottish Labour leader Kezia Dugdale described the publication of the draft bill as "irresponsible economic vandalism".
She added: "Instead of seeking fresh divisions, the SNP should be prioritising our public services such as education and healthcare.
"This is a referendum that Scotland does not need or want. Nicola Sturgeon should keep the promise she made that the 2014 referendum was a once-in-a-generation vote."
Scottish Liberal Democrat leader Willie Rennie said: "It is now crystal clear that the SNP's priority is not education. It is not health, or even working to protect the benefits of our EU membership. It is independence."
But Scottish Greens co-convenor Patrick Harvie said it would be "foolish" for the UK government to block a second referendum.
He added: "The Westminster government's inability to acknowledge the overwhelming mandate for Remain in Scotland, or demonstrate any kind of flexibility the union could take in the individual UK nations' forging relations with Europe, shows that independence is quickly becoming the most realistic option for Scotland to shape its own partnership with the European Union."