Labour has been pushed into third place in Scotland following a disastrous performance in Thursday's Holyrood election, as the Tories finished second and the SNP dominated but fell short of a majority.
The SNP won 63 seats, two short of a majority and six down on 2011, while Ruth Davidson's Scottish Conservatives were up 16 to 31 and Labour lost 13 seats overall to 24.
Nicola Sturgeon was returned as Scottish first minister in the vote, meaning the SNP has claimed three Scottish election victories in a row. The SNP won all the constituencies in the historic Labour heartland of Glasgow.
"We made history this evening," Sturgeon told the audience after her success.
But the story of the night was Davidson's Scottish Conservatives, who made dramatic gains as the leader took the Edinburgh Central constituency from the SNP. Their campaign was helped by an apparently substantial shift of pro-union voters from Labour to the Tories across Scotland.
The true scale of Scottish Labour's problems became clear at around 4am as a string of results went against the party, with the SNP picking up several constituency seats off its left-wing rival.
Labour also lost council seats across England and Wales, but outperformed expectations by retaining control of local authorities such as Harlow, Crawley, and Southampton. Some in the party had feared they would lose control of these councils to the Tories, but in the end Labour clung on in the majority of areas it was defending.
As a result, internal Labour opponents of Jeremy Corbyn who had predicted the party would suffer a catastrophic electoral performance in Thursday's elections admitted there was now no chance of an imminent coup against the leader.
However, the result has raised concerns about the growing impact of UKIP on Labour. Nigel Farage's party took votes from Labour and won a number of council seats in areas such as Essex and the North East of England.
Labour MP Jo Cox told the BBC she was "disappointed" with her party's local election performance, since it had failed to win extra councillors to help campaign for victory at the next general election.
"This is not a route back to power in 2020 for the Labour party," she said, directly criticising Corbyn for not exploiting the weakness of the Conservative government. "Jeremy and the leadership have to take responsibility for what has been a poor night for us."
In Wales, Labour struggled with the rise of Plaid Cymru and UKIP and looked set to lose its overall majority in the Welsh assembly, though it will remain the largest party and is likely to form a minority government. The party's problems were underlined by the success of Plaid Cymru leader Leanne Wood, who took the Rhondda constituency from Labour.
Two Westminster by-elections in Wales and Sheffield were won by Labour candidates, and the mayor of London result is due to be announced later on Friday.
Shadow chancellor John McDonnell said the wide variety of different local elections meant the overall picture was "all very complex" but insisted the party had exceeded expectations.
But in Scotland the result was grim, with Labour losing seats such as Eastwood – which has a large Jewish population – to the Conservatives following last week's row over Ken Livingstone's alleged anti-Semitic comments.
"Labour is over in Scotland," observed a depressed Scottish Labour staff member at the Edinburgh election count.
Scottish Labour leader Kezia Dugdale failed to win the Edinburgh Eastern seat, although she is expected to be returned as an MSP on the regional list vote.
The Tories made substantial gains in Scotland, leaving themselves well-placed to become the official opposition in the Scottish parliament when list votes are counted later on Friday morning. The SNP is set to remain the largest party, although a number of unexpected losses – including some to the resurgent Scottish Liberal Democrats – means it may have a smaller majority in the parliament.
Overall, Labour's vote was down across the UK, although the Conservative vote also fell, enabling Labour to limit its losses. As a result, Jeremy Corbyn's position appears to be secure, despite making few gains.