The SNP continued its sweep of glory in Dunfermline and West Fife.
The seat previously regarded as safe for Labour was wrenched from the party’s grip by nationalist Douglas Chapman.
The Rosyth councillor, who lives in Dunfermline, won with 50% of the vote and a 10,352 majority over Labour’s Thomas Docherty.
In his victory speech, he said: “Scotland’s voice must be heard louder at Westminster and after tonight it will be.
“There can only be one winner and on this occasion it’s the SNP which has taken the prize.”
After thanking his family, those involved in the election and those who supported his campaign, he said: “Most of all I want to thank the people of Dunfermline and West Fife.
“It’s hugely humbling to be elected as an MP and my hard work begins now.
“Whatever you voted, I’m here to represent everyone in this constituency and will do that to the best of my ability.
“I am desperate not just to be your MP but the best MP you’ve ever had.”
He pledged to deliver on his commitments during his time in parliament and on the party’s anti-austerity and anti-Trident agenda and to help ensure Scotland “takes its place in the wider world”.
Mr Docherty, who took the seat in 2010 from Liberal Democrat Willie Rennie, thanked the people of Dunfermline and West Fife for the honour of representing them and said if Mr Chapman had half the fulfilment he had he would have a “grand five years”.
Ahead of the declaration Mr Docherty refused to be interviewed by the press and said: “I’m retired, the electorate has spoken.”
Aside from the Lib Dems’ four-year tenure following a surprise win in the 2006 byelection, the seat, previously Dunfermline West, had been under Labour for three decades.
Mr Chapman’s share of the vote was a 40% swing from the 2010 election, when SNP candidate Joe McCall won only 5,201 votes.
Lewis Campbell (Greens) 1,195 (2.1%)
Douglas Chapman (SNP) 28,096 (50%)
Gillian Cole-Hamilton (Liberal Democrats) 2,232 (4%)
Thomas Docherty (Labour) 17,744 (32%)
James Reekie (Conservatives) 6,623 (12%)