Holyrood 2016: SNP mixed fortunes and Tory gains
The SNP enjoyed mixed fortunes in Edinburgh and Lothians, with the Tories the biggest winners on the Lothian list.
In addition to Ruth Davidson's victory in Edinburgh Central, the Scottish Conservatives won three list seats.
Former Scottish Labour leader Iain Gray held onto East Lothian, against opposition from former pub landlord DJ Johnston-Smith of the SNP.
And the Greens saw Andy Wightman and Alison Johnstone elected as list MSPs.
Scottish Conservative leader Ruth Davidson's victory in Edinburgh Central was one of the big stories of the night.
Ms Davidson, who only recently switched her political base to the capital, overtook the SNP's Alison Dickie's by 610 votes.
The Scottish Labour leader failed Kezia Dugdale failed to muster support in the Edinburgh Eastern constituency vote and had to rely on the regional list to secure her return to Holyrood.
Her colleague Neil Findlay is also back - thanks to the list system.
And there was a Labour gain for Daniel Johnson in Edinburgh Southern when he beat the SNP's Jim Eadie.
Along with former leader Iain Gray's victory in East Lothian, that provided a glimmer of hope for the party on an otherwise bleak night.
For the SNP it was a mixed bag; across Edinburgh and the Lothians it took six constituency seats - but failed to make headway among the list MSPs.
Ben MacPherson took Edinburgh North and Leith from Labour, winning 6,746 more than Lesley Hinds who came second.
But that was offset by Labour's win in Edinburgh Southern - and a Lib Dem victory for charity worker Alex Cole-Hamilton in Edinburgh Western.
That, coupled with his win in Fife North East, gave Willie Rennie something to smile about.
The Scottish Liberal Democrat leader beat the SNP's Roderick Campbell by 3,465 votes.
Nationally though the Lib Dems were overtaken as the fourth biggest party by the Scottish Greens - a feat due in part to the election on the Lothian list of land campaigner Andy Wightman and Alison Johnstone.