The SNP has lost its overall majority in the Scottish Parliament as a resurgent Conservative Party made gains and Labour was hammered.

On a disastrous night for Labour north of the border, the party slumped to third place, and although the SNP won by a large margin, it unexpectedly lost its overall majority in the Holyrood parliament and will have to rely on the support of other parties to pass legislation.

Labour ended the night with just 24 MSPs, shedding 13 from its 2011 election results – while the Tories became the largest opposition party with 31 seats, up 16.

The SNP won 63 seats, slightly down on its previous result despite long bookies’ odds of just 8/1 on it losing its majority.

In a humiliating turn of events for already struggling Scottish Labour, the party’s leader Kezia Dugdale failed in her bid to win a constituency seat in Edinburgh and was forced to enter parliament through the regional list.

By contrast, Conservative leader Ruth Davidson pulled off a shock victory in Edinburgh Central, taking her party from fourth place to first there and ousting the area’s SNP representative.

SNP wins third term but loses majority

Ms Davidson was visibly ecstatic, telling the count at Edinburgh’s Highland Centre that voters across Scotland had “sent a message” to the Scottish National Party.

She featured heavily in the Tory campaign, with the party’s Conservatives branding practically absent from literature, replaced by the slogan “Ruth Davidson for a Strong Opposition”.

The leader said after the result that she had been elected to do “a very specific job – hold the SNP to account”.

“I fully recognise and understand there are many people that have given us their vote for the very first time, not because they're true blue Conservatives, but because there's a job of work they want us to do,” she said.

Ms Dugdale told a dwindling crowd who had stayed up for her election via the list at the Edinburgh count that the contest was “always going to be tough” for Scottish Labour.

UK Labour leader Jeremy Corbyn said there was "hard work" to do north of the border, but that he would support the Scottish party.

"We are going to be with you. We are going to walk hand in hand with the party in Scotland to build that support up once again so that the Labour tradition in Scotland will be established once again," he said.

Despite losing its majority the SNP was still the undisputed winner of the night – although it will now face the choice of either going into coalition government, operating as a minority government, or doing a formal deal with another party.

The two maps below show how Scotland's political outlook has changed in the five years between this year’s Holyrood elections and those in 2011 (

The SNP captured all nine seats in Scotland’s largest city, Glasgow, wiping out the remaining four Labour constituencies there. Across the country Labour gained just one seat from the SNP – in Edinburgh Southern.

The party’s leader Nicola Sturgeon told supporters that they had “made history” with the result. She also said the party would not seek a formal deal with any other party and would instead function as a minority government.

"We won a clear and unequivocal mandate and I secured the personal mandate I sought to implement the bold and ambitious programme for government that I asked the country to vote for," she said after the result became clear.

"I can confirm that when it reconvenes in the coming days I will ask the Scottish Parliament to formally re-elect me as the First Minister of Scotland. It will then be my intention to form and to lead an SNP government.

Elections 2016: Agony and ecstasy for candidates as results pour in Show all 10 1 /10 Elections 2016: Agony and ecstasy for candidates as results pour in Elections 2016: Agony and ecstasy for candidates as results pour in SNP leader Nicola Sturgeon waves after winning her seat Glasgow Southside in the Scottish Parliament elections at the Emirates Arena in Glasgow Getty Images Elections 2016: Agony and ecstasy for candidates as results pour in Leader of the Scottish National Party (SNP), Nicola Sturgeon embraces Margaret Ferrier (L), and Janet Doris (R) as her husband Bob Doris (unseen) speaks to the audience at the Emirates Arena in Glasgow EPA Elections 2016: Agony and ecstasy for candidates as results pour in SNP leader Nicola Sturgeon reacts as results come in at a Scottish Parliament election count at the Emirates Arena in Glasgow PA Elections 2016: Agony and ecstasy for candidates as results pour in Labour Party members celebrate after David Burton Sampson (centre) wins the Labour seat for St Martin's ward during the election count for Basildon at the Sports Village in Basildon, Essex PA Elections 2016: Agony and ecstasy for candidates as results pour in Scottish Labour leader Kezia Dugdale, who failed in her bid to win the Edinburgh Eastern constituency from the SNP, at the count at the Royal Highland Centre, Ingliston, Renfrewshire PA Elections 2016: Agony and ecstasy for candidates as results pour in Scottish Conservative leader Ruth Davidson is congratulated after she won the Edinburgh Central seat at the count at the Royal Highland Centre, Ingliston, Renfrewshire PA Elections 2016: Agony and ecstasy for candidates as results pour in Scottish Conservative leader Ruth Davidson speaks after winning the Edinburgh Central seat at the count at the Royal Highland Centre, Ingliston, Renfrewshire PA Elections 2016: Agony and ecstasy for candidates as results pour in Scottish Conservative leader Ruth Davidson arrives at a Scottish Parliament election count at the Royal Highland Centre, Ingliston, Renfrewshire PA Elections 2016: Agony and ecstasy for candidates as results pour in SNP supporters react as their party wins another seat at a counting centre in Glasgow Reuters Elections 2016: Agony and ecstasy for candidates as results pour in Vaughan Gething of Labour retains his seat for Cardiff South and Penarth during the National Assembly for Wales election count at the Sport Wales National Centre in Cardiff, Wales Getty Images

But University of Strathclyde political scientist Professor John Curtice said the nationalists had possibly been “the victims of exaggerated expectations” at the elections – with a widely predicted majority not materialising.

The dark horses of the election were the Liberal Democrats, who also made unexpected gains from the SNP in Edinburgh Western and North East Fife, where the party’s leader Willie Rennie was elected.

The Scottish Greens, too, had a strong showing in the Glasgow Kelvin constituency, where its leader Patrick Harvie came second to the SNP.

Overall, the left-wing environmentalists tripled their representation from two MSPs to six, all elected under regional lists. As the only other pro-independence party in the Scottish Parliament its members are now prime candidates to cooperate with the SNP-led minority government – as they did after the 2007 elections.

The Greens backed that government, which was led by Alex Salmond, in exchange for a Climate Change Bill and Green MSPs on a key parliamentary committee.

There still still a majority in favour of Scottish independence in the Scottish Parliament, though the Greens have said they would only consider a second independence referendum in the event of a petition of a million signatures being handed in.

Smaller parties RISE, Solidarity, and the Women’s Equality Party failed to make an impact.

Turnout in Thursday’s elections was around 55 per cent, marginally up on 2011.

Labour had a better night in England’s local elections, where it exceeded expectations by retaining control of key councils in the south – Harlow in Essex, Crawley in Sussex, and Southampton on the south coast.