Nicola Sturgeon has issued a warning to Boris Johnson over a second independence referendum, declaring the prime minister will be "picking a fight with the democratic wishes of the Scottish people" if he tries to block another vote.
Speaking as votes continue to be counted in the Holyrood elections, Ms Sturgeon said: "You will not succeed, the only people who can decide the future of Scotland are the Scottish people."
She added that the timing of another referendum "should be a matter for the Scottish Parliament" and is "not a decision for Boris Johnson or any Westminster politician".
Ms Sturgeon said the people of Scotland "must have the right to decide our own future when the COVID crisis has passed", describing it as a "matter of fundamental democratic principle".
The SNP’s hopes of winning an overall majority appear to be fading, but the party will be the largest party at Holyrood and is set for an historic fourth term in office.
Ms Sturgeon said the party had "won more votes and a higher share of the votes in the constituency ballot than any party in the history of devolution", describing this as an "extraordinary and historic achievement".
It sets the stage for a battle between Holyrood and Mr Johnson’s government in Westminster over a second referendum.
The SNP has vowed to introduce legislation for another vote, but this could be challenged by the UK government in court.
Ms Sturgeon has argued that winning more than half of the seats in the Scottish Parliament will give her a mandate to hold another vote.
But opponents of such a move will likely seize upon the SNP’s failure to win an outright majority if that comes to pass.
Foreshadowing such an attack, the PM said on Friday that it was his impression that voters had "moved away from the idea of a referendum".
With 115 of the 129 results declared, the SNP has 63 seats, the Scottish Conservatives 25, Scottish Labour 17, the Liberal Democrats 4 and other parties on 6.
65 seats are needed for an overall majority.
The SNP gained three seats in the results that were declared on Friday, but this success could cause the party to lose regional seats under Scotland’s proportional electoral system.
The pro-independence Scottish Greens are expected to gain seats in the regional list vote, meaning there would be a majority in favour of a second referendum at Holyrood.
Ms Sturgeon said the SNP failing to win a majority would not be a "huge surprise".
"I’ve said all along a majority was a long shot. We have a PR system in Holyrood, it’s not meant to deliver majorities. But I’m thrilled with our results," she said.
Sturgeon has dialled up the rhetoric and put the ball in Johnson’s court
Analysis by Joe Pike, political correspondent
A constitutional clash is now inevitable: standby for yet another battle between the Scottish and UK governments as Nicola Sturgeon pushes for a second independence referendum. Tonight she dialled up the rhetoric and the pressure. Boris Johnson will need to make the next move.
Ms Sturgeon’s victory in Scotland is historic in multiple ways. But she still fell short of the SNP majority she craved, and which she argued would give her the mandate for another vote on leaving the UK. That will be a relief for the prime minister.
More than half of Holyrood’s new MSPs will still back independence (if you add the SNP and the pro-indy Scottish Greens), and that group is likely to be slightly larger than in the last parliamentary session.
Yet Boris Johnson will be relieved that the nationalists were unable to secure the SNP majority they won in 2011, which led to the 2014 referendum and 55% backing for remaining part of the UK.
At this Holyrood election, turnout was up, as was tactical voting – in particular pro-union Scots choosing the party with the best chance of beating the SNP.
Scotland remains split on the central issue of the constitution: almost 50/50. There seems little sign that divide will be bridged anytime soon.