Nicola Sturgeon has set the date for a proposed "consultative referendum" next year on Scottish independence.
To cheers and applause in the devolved parliament in Holyrood, the first minister said legislation will lay out plans for a vote to take place on 19 October 2023.
It will ask the question: "Should Scotland be an independent country?"
Ms Sturgeon acknowledged that her plan could face legal blocks or resistance from the UK government - and threatened that if so her party, the SNP, would fight the next general election as a "de facto referendum" instead.
The Scottish first minister said the Holyrood government had a "clear mandate" to go for another vote - after independence was rejected in a previous poll in 2014.
She said papers were being filed with the Supreme Court to seek to establish the lawfulness of her plans and that she was "ready and willing" to negotiate with the Westminster government on the terms of holding the referendum.
But she added: "What I am not willing to do, what I will never do, is allow Scottish democracy to be a prisoner of Boris Johnson or any prime minister."
Ms Sturgeon said a majority vote would not by itself make Scotland independent - and that legislation would have to be passed by both the UK and Scottish parliaments to give effect to the decision.
The 2014 referendum went ahead only after a so-called Section 30 order permitting it was issued by the Westminster government.
Ms Sturgeon said: "If it does transpire that there is no lawful way for this parliament to give the people of Scotland the choice of independence in a referendum, and if the UK government continues to deny a Section 30 order, my party will fight the UK general election on this single question: should Scotland be an independent country?"
Setting out the case for independence, the first minister claimed that Scotland was being held back from fulfilling its potential by "Westminster governments we don't vote for imposing policies we we don't support".
"That reality has rarely been starker than it is now," Ms Sturgeon said, citing Brexit and the cost of living crisis as well as accusing Boris Johnson's administration of stoking industrial strife and a trade war.
"It does not have to be this way," she added. "Independence is about equipping ourselves to navigate the future, guided by our own values, aspirations and interests.
"Now is the time, at this critical moment in history, to debate and decide the future of our country. Now is the time to get Scotland on the right path - the path chosen by those who live her.
"Now is the time for independence."
Douglas Ross, leader of the Scottish Conservatives, accused Ms Sturgeon of taking her eye off the ball by putting Scotland's real priorities "on the backburner" in favour of a "selfish obsession" with a referendum.
He added: "All of our focus should be on tackling the huge challenges we face right now: helping families with their bills, supporting front line services and creating good jobs.
"A potentially illegal referendum next year is the wrong priority for Scotland."
A Downing Street spokesman said the government would "carefully study the details of the proposal" from the first minister.
He added that the prime minister "continues to think it's not the time to be talking about a referendum".
Speaking earlier on the final day of the G7 summit, Mr Johnson said the government would "see what she [Nicola Sturgeon] has to say", adding: "I think the important point to make is that we think the number one priority for the country is the economic pressures, the spikes in the cost of energy."