Nicola Sturgeon's SNP has won an historic third term in government at Holyrood, as Labour suffered further losses in its former Scottish heartlands.

A year after losing all but one of its MPs, the party endured another disappointing election result - with the Tories poised to become the official opposition in the Scottish Parliament.

With Scottish politics still dominated by the constitution, Labour leader Kezia Dugdale said her party's "determination to try to move the Scottish debate on" from the arguments of the 2014 independence referendum had cost votes.

The Herald:

READ MORE: Live: Scottish election 2016

But she insisted she will remain as leader of the party "no matter what".

Ms Dugdale failed in her bid to win the Edinburgh Eastern constituency but was elected via the Lothian list.

In contrast, her Conservative counterpart Ruth Davidson took the Tories from fourth to first in Edinburgh Central, winning the seat from the SNP.

The Herald:

The Tories made another gain from the SNP in Aberdeenshire West, where Alexander Burnett ousted Dennis Robertson, while Scottish Conservative deputy leader Jackson Carlaw and Oliver Mundell, the son of Scottish Secretary David Mundell, won the Eastwood and Dumfriesshire seats from Labour respectively.

READ MORE: Ruth Davidson 'sending the SNP a message' with Tory resurgence

Labour lost all of the constituencies it had held in Glasgow to the SNP, a repeat of the fate it suffered in last year's Westminster election.

Ms Sturgeon, who was comfortably returned as the MSP for the Glasgow Southside constituency, said: "I want to thank the people of this great city of Glasgow.

"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."

READ MORE: Live: Scottish election 2016

She went on to thank "with great humility the people of Scotland for placing their trust in me and in the SNP".

Ms Sturgeon continued: "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."

The Tory campaign had focused on providing a strong opposition to the SNP, and Ms Davidson said: "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 hailed her victory in Edinburgh Central as an "incredible result", and added: "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. That's what people want."

Early indications that it could be a bad night for Ms Dugdale's Labour were apparent from the second seat to be declared.

Labour lost the Rutherglen constituency which it had held since 1999 to the SNP, with mental health nurse Clare Haughey elected as the new MSP for the area.

Seats which had previously been considered part of Labour's heartlands also fell to the nationalists, including Motherwell and Wishaw, and Greenock and Inverclyde.

Former Labour leader Iain Gray managed to hold on to his East Lothian constituency, but the party's current deputy Alex Rowley lost the Cowdenbeath seat that he had won in a by-election, and was returned to Holyrood via the Mid Scotland and Fife list.

Veteran Labour MSP Jackie Baillie held on to the Dumbarton constituency she has represented since 1999, but with a majority of just 109 over the SNP.

And Labour enjoyed a rare gain from the SNP in Edinburgh Southern, where Daniel Johnson won the seat for the party.

Anas Sarwar, former Scottish Labour deputy leader, conceded: "Undoubtedly it's a difficult night for the Labour Party."

Ms Sturgeon described the collapse in support for Labour as "quite staggering".

READ MORE: Live: Scottish election 2016

The Liberal Democrats made some gains, with their leader Willie Rennie winning the North East Fife constituency, while children's charity worker Alex Cole-Hamilton was elected as the new MSP for Edinburgh Western, taking the seat from the SNP.

Scottish Green co-convener Patrick Harvie was re-elected as an MSP for the Glasgow region, with the party winning two seats on the Lothian list and another from Mid Scotland and Fife.

With the party having increased its tally of MSPs, the Greens could hold the balance of power if the SNP fails to win a second majority at Holyrood.