Media playback is unsupported on your device Media caption "We have tonight made history" - SNP's Nicola Sturgeon

SNP leader Nicola Sturgeon has declared that her party has won a historic third victory in the Holyrood election - but it did not manage an overall majority.

The SNP won 63 seats - two short of a majority which it enjoyed in the last parliament with 69 seats.

The Conservatives are the second largest party on 31. Labour had a dismal night taking 24 seats - down 13.

The Scottish Greens are the fourth largest party with six seats, ahead of the Liberal Democrats who won five.

The SNP would have needed 65 seats to have a majority, a feat it managed in 2011 despite the voting system being designed to prevent one party having overall control.

In 2007, the SNP was the largest party, with one seat more than Labour, but formed a minority government.

Image copyright PA

Scotland's Additional Member System sees 73 constituency MSPs elected through first-past-the-post and 56 regional MSPs elected, from eight electoral regions, through a form of proportional representation.

The SNP dominated the constituency vote taking 59 of the 73 seats - an increase of six on the 2011 election.

The Conservatives won seven, four up on last time, and the Liberal Democrats took four, an increase of two. The big loser was Labour which won three seats - down 12.

Regional results

The SNP's dominance was not reflected in the proportional regional system.

The SNP has four regional MSPs - down 12; the Conservatives have 24, up 12; Labour was down one, to 21; the Scottish Greens have six, up four; and the Liberal Democrats won one regional seat, down two on their previous result.

Some of the main headlines from the night:

All of the party leaders in Scotland, with the exception of Labour's Kezia Dugdale, are claiming it has been a successful election.

Ms Sturgeon held her Glasgow Southside seat with a majority of almost 10,000 votes as the SNP won all eight seats in the city - including four from Labour.

Image copyright PA Image caption Kezia Dugdale said she was "heartbroken" at Labour's collapse in Scotland

Reflecting on her party's wipeout of Labour in its traditional Glasgow heartland, Ms Sturgeon said: "If you had told me when I was a teenager, starting out in politics, that one day the SNP would win every constituency in the city of Glasgow, not just in one election but in two elections, I would scarcely have been able to believe it."

She added: "What is now beyond doubt is that the SNP has won a third consecutive Scottish Parliament election.

"That has never been done before in the history of the Scottish Parliament. We have tonight made history."

Speaking after watching Labour's vote crumble across Scotland, Ms Dugdale said she was "heartbroken, without question".

'Painful defeat'

"This election was always going to be tough for the Scottish Labour Party, just a year after a painful general election defeat," she said.

"But I am proud that our campaign rose to the challenge of offering an alternative vision of what could be done in our new, more powerful parliament."

Analysis by Sarah Smith, Scotland editor

For Scottish Labour, arguments over their manifesto or personalities are to miss the point. This election was clearly about the constitution.

Scottish politics are still totally dominated by the independence question which was certainly not settled on 18 September 2014 and still seems to take precedence in voters' minds over any other issue.

And it's an issue on which Labour cannot win.

So where does that leave Labour?

If the SNP are the party of independence and the Tories the party of the union, what is the point of the Labour Party?

They will continue to argue that they care most about social justice and poverty. But as long as voters remain split over the constitution that may not win back many voters.

Read more from Sarah

Conservative leader Ruth Davidson hailed an "incredible result" after she took Edinburgh Central from the SNP with a majority of 610.

Reflecting on her party's resurgence and emergence as the biggest opposition party in Scotland, she said: "I hope the message that was resonating was of being a strong opposition, to hold the SNP to account, to saying no to a second independence referendum, to respect the decision that our country made, and to really focus on the things we're paying a government to focus on, on schools, on hospitals, on public services."

Image copyright Getty Images

Scottish Liberal Democrat leader Willie Rennie, who won the Fife North East seat from the SNP, said his party had secured "quite a remarkable result", pointing to successes in different parts of the country.

"If you look at the results in Orkney and Shetland - both over 60% of the vote when people were predicting we were going top be wiped out.

"Then, in North East Fife and Edinburgh West we won from the SNP - winning from the SNP when they seemed to be rampant everywhere else in the country."

Image caption Liberal Democrat leader Willie Rennie won Fife North East from the SNP

The constituency seats which changed hands

Aberdeenshire West: Conservative (was SNP)

Coatbridge & Chryston: SNP (was Labour)

Cowdenbeath: SNP (was Labour)

Dumfriesshire: Conservative (was Labour)

Eastwood: Conservative (was Labour)

Edinburgh Central: Conservative (was SNP)

Edinburgh Northern & Leith: SNP (was Labour)

Edinburgh Southern: Labour (was SNP)

Edinburgh Western: Liberal Democrat (was SNP)

Fife North East: Liberal Democrat (was SNP)

Glasgow Maryhill & Springburn: SNP (was Labour)

Glasgow Pollok: SNP (was Labour)

Glasgow Provan: SNP (was Labour)

Greenock & Inverclyde: SNP (was Labour)

Motherwell & Wishaw: SNP (was Labour)

Renfrewshire South: SNP (was Labour)

Rutherglen: SNP (was Labour)

Uddingston & Bellshill: SNP (was Labour)

The gains and losses