Angus CochraneSenior political journalist, BBC Scotland
The SNP has won a fifth successive Scottish Parliament election, but fallen short of its target of an overall majority at Holyrood.
The party won 58 seats, with 65 needed for a majority.
The Conservatives lost their position as the parliament’s largest opposition party, suffering their worst-ever Holyrood election result to finish with 12 seats.
The Liberal Democrats, meanwhile, returned 10 MSPs.
Overall, there is a majority of parties at Holyrood who support Scottish independence – with the SNP and the Greens totalling 73 of the 129 seats.
While the SNP is expected to return to government, it will have to rely on help from other parties to pass legislation and reinstall Swinney as first minister.
The SNP leader told BBC Scotland News that his party had won the Holyrood election “hands down”.
As a result of this “commanding position”, he added “the public expectation will be for me to be returned as first minister and to lead a government”.
Along with an SNP victory, it had long been predicted that Reform UK – led in Scotland by former Tory peer Malcolm Offord – would become a major force at Holyrood.
The party, promising tax cuts and action to curb immigration, had never had an MSP elected before – previous MSPs had defected from other parties.
Reform’s best hope of a constituency victory – where the candidate with the most votes is elected – was in Banffshire and Buchan Coast, but the party lost out to the SNP by just 364 votes.
Offord, who was elected via the West of Scotland list, told BBC Scotland News he had aimed to get more than 20 MSPs, but that the result would provide “a really good group to establish a base inside Holyrood”.
The Reform leader said his party would be “challengers and scrutineers” of the Scottish government.
And he added: “We will be very focused on trying to get Holyrood focused on the day job, on devolved matters and really highlighting the issues that matter to people on the doorsteps: the schools, the roads, the day-to-day matters that Holyrood needs to be focused on.”
Reform’s success, fracturing the unionist vote, helped the SNP return a swathe of constituency seats despite their share of the vote declining since 2021.
The Greens backed that up in Glasgow Southside, Nicola Sturgeon’s old seat, with the party returning a further 13 MSPs on the list.
Co-leader Ross Greer called it a “historic day” for his party.
On a disappointing day for Scottish Labour, Anas Sarwar effectively declared defeat after just seven seats had been announced.
He told reporters that Labour had failed to overcome “a national wave of disappointment”, adding: “My party is hurting today and it’s my job to hold it together.”
His deputy, Jackie Baillie, did manage to hold onto her seat – Dumbarton – which she has held since 1999.
Baillie backed Sarwar to continue as leader, but said voters’ perceptions had been “coloured” by the performance of the Labour UK government.
The Scottish Conservatives had enjoyed 10 years as Holyrood’s largest opposition party.
That position has been lost – they have dropped into fourth place, as Reform ate into their support.
Leader Russell Findlay, who was returned on the West of Scotland list, said: “While I’m pleased that we won the bulk of the constituencies we were defending, I’m disappointed to have lost so many excellent parliamentary colleagues.
“We warned repeatedly during the campaign that Reform were a gift to the SNP – and so it’s proved.
“Despite not winning a single constituency seat, Reform have let the SNP sneak home in several constituencies they would otherwise have lost.”
While the Lib Dems lost Shetland, they won seven constituency seats.
Alex Cole-Hamilton’s party overturned a large SNP majority in Skye, Lochaber and Badenoch, where former deputy first minister Kate Forbes was stepping down.
Cole-Hamilton said that his MSPs would “deliver change with fairness at its heart”.
Phil SimScotland political correspondent
The SNP has defied political gravity by winning a fifth consecutive term in office.
Yes, John Swinney’s party has fallen short of their self-imposed goal of securing an outright majority – but the Holyrood system makes that an incredibly tall order.
And they will finish miles clear of a hopelessly fractured pack of opposition parties.
Labour and the Conservatives are each in a desperate position, with the former having lost seats at every Holyrood poll since 1999 and the latter scoring their worst ever result.
Reform UK meanwhile have come from nowhere to tie with Labour in second place. Having sparked frequent confrontations and fiery rhetoric during the campaign, they may have a similarly explosive impact on the new term of parliament.
The Scottish Greens are in bouyant mood, having captured their first ever constituencies and list representation in every part of Scotland.
And the Lib Dems have shaken off the shock loss of Shetland to grab new seats from the rural Highlands to the urban central belt.
All three of those parties will feel they have growing influence, and will want to make their mark on the next five years.