Alex Salmond ousted in a disappointing night for the SNP
The SNP have seen their share of the vote slump - here are the big stories of the night
Last updated 9th Jun 2017
Former first minister Alex Salmond has lost his seat to the Conservatives in a disappointing night for the SNP
The SNP lynchpin and ex-party leader was defeated by Colin Clark in Gordon.
Mr Salmond, the SNP's foreign affairs spokesman, had swept to power in the seat with a 8,687 majority in 2015, overturning decades of Liberal Democrat rule.
The party's leader Nicola Sturgeon said she was "disappointed by the SNP losses" but added the result was the second best ever for the party.
Elsewhere SNP depute leader Angus Robertson has been spectacularly ousted from Parliament by the Tories, as the nationalists saw their share of the vote slump.
Mr Robertson, who had been the SNP's leader at Westminster, had been defending a majority of more than 9,000 but he was felled by Conservative Douglas Ross.
The Tory, who is also a football referee, won 22,637 votes, easily beating Mr Robertson who polled 18,478.
Other high-profile SNP scalps taken by the Tories were Mike Weir, who was defeated in the Angus seat he has held since 2001, and Tasmina Ahmed-Sheikh, who lost Ochil and South Perthshire.
During the campaign, Scottish Tory leader Ruth Davidson had declared it would be an "Ed Balls moment" if her party could eject the SNP's depute leader - referring to Labour's former shadow chancellor losing his seat in 2015.
After the result was declared, she tweeted: "Fantastic in Moray!"
In East Dunbartonshire, Liberal Democrat Jo Swinson regained the seat from the SNP's John Nicolson.
Ms Swinson had held the seat for a decade before being ousted by Mr Nicolson in 2015.
After the result was declared, she said: "I recognise all of those who put party allegiance to one side to send a clear message that East Dunbartonshire does not want another divisive independence referendum.
"Nicola Sturgeon, I hope you're listening."
The SNP also lost out in East Renfrewshire, this time to the Tories.
Paul Masterton took the constituency - which 20 years ago had been the safest Tory seat in Scotland - from the SNP's Kirsten Oswald.
The results came after an exit poll suggested the SNP could lose 22 seats across Scotland.
The nationalists had swept the board in 2015, winning 56 of the 59 seats up for grabs - leaving Labour, the Conservatives and the Liberal Democrats with just one MP each.
But in the 2017 election, the first result in Scotland went to Labour as the party won Rutherglen and Hamilton West.
Gerard Killen claimed the seat for Jeremy Corbyn's party with 19,101 votes, defeating the SNP's Margaret Ferrier, who won the constituency in 2015 but who polled 18,836 votes this time round.
After being elected, Mr Killen declared: "This result is a rejection of austerity and a rejection of a divisive second independence referendum.
"Above all this result is a vote for a progressive manifesto and a fresh start for Rutherglen and Hamilton West."
Scottish Labour leader Kezia Dugdale said on Twitter she was "utterly thrilled" for Mr Killen, adding that he will be "an outstanding MP".
Labour also defeated the SNP to win the Midlothian constituency.
But in Paisley and Renfrewshire South, the SNP's Mhairi Black was re-elected with 16,964 votes - although the party's support in the seat fell by 10%.
Ms Black became the youngest MP when she won the seat in 2015 at the age of 20, ousting then Labour shadow foreign secretary Douglas Alexander.
Gavin Newlands has held the neighbouring Paisley and Renfrewshire North seat for the SNP.
Pete Wishart, who was the chair of the Scottish Affairs Committee in the last Parliament, managed to hold on to his Perth and North Perthshire constituency - but by the narrowest of margins.
He was returned to the Commons after securing just 21 more votes than Conservative MEP Ian Duncan.
After a recount, it was declared Mr Wishart had 21,804 votes, putting him ahead of Mr Duncan on 21,783.
But the Tories took Ayr, Carrick and Cumnock from the SNP, with local councillor and former fireman Bill Grant winning the seat.
Aberdeen South also switched from SNP to Conservative, with MSP Ross Thomson claiming the Westminster constituency.
Former SNP leader Alex Salmond blamed a late surge in support for Labour's Jeremy Corbyn for the loss of a number of nationalist seats.
But he was insistent the SNP will win the election north of the border.
The Tories gained one of their main target seats of Berwickshire, Roxburgh and Selkirk with former MSP John Lamont defeating the SNP's Calum Kerr.
Labour picked up a further gain at Coatbridge, Chryston and Bellshill as Hugh Gaffney ousted the SNP's Phil Boswell.
The Liberal Democrats regained Caithness, Sutherland and Easter Ross as former MSP Jamie Stone took the seat from the SNP's Paul Monaghan.