David Cameron is set to pull off a surprise victory in the United Kingdom’s general election, putting Britain on course to hold a referendum on its membership of the European Union, and raising questions over Scotland’s future in the UK.

Polls had predicted that the Conservatives and Labour would be neck and neck, with the centre-left party in a stronger position to form a coalition government.

Cameron promised the in/out Brexit vote by 2017, if he was elected. Speaking on Friday, he said it was a “referendum we must hold”.

The Conservatives are set to remain the largest political party in Britain, with more votes than they won in 2010. The Tories were predicted to take 316 seats, compared to Labour’s 239 seats. Just before publication, the latest polls said the Tories would win enough seats to form a government, without the need for coalition partners.

>>Read: Brussels will breathe a sigh of relief when I’m gone, says Cameron

At about 5AM UK time on 8 May, it was also expected that the pro-EU Scottish National Party (SNP) had taken all but three Westminster seats in Scotland.

Labour lost 19 seats, according to exit polls, suffering a disappointing result that raised questions over leader Ed Miliband’s credibility, and his ability to continue in charge. Bookmakers earlier had odds of 6/4 on Miliband resigning before midnight today.

“This has clearly been a very difficult and disappointing night for the Labour Party,” said Miliband this morning. “Scottish nationalism overwhelmed us,” he added after holding his seat in Doncaster.

Douglas Alexander, the shadow foreign secretary and campaign chief, lost his seat to a 20-year-old SNP candidate, as did Jim Murphy, the leader of the Scottish Labour Party.

At time of writing, it was being reported that Shadow Chancellor Ed Balls, would be defeated in the English seat of Morley and Outwood.

Lib Dems and UKIP devastated

The SNP’s crushing victory, just eight months after Scots voted yes to staying in the UK, was mirrored by a devastating wipe-out for the pro-EU Liberal Democrats.

The Lib Dems lost 47 seats, according to exit polls. Coalition government ministers including Business Secretary Vince Cable, Chief Secretary of the Treasury Danny Alexander and Energy Secretary Ed Davey were booted out by the electorate. So was former leader Charles Kennedy.

But current party head, and Deputy Prime Minister Nick Clegg, hung onto his seat in Sheffield Hallam, fighting off a Labour onslaught in the key battleground constituency.

Despite that, there was speculation he would not be able to continue as leader of the Lib Dems, after the loss of so many senior party figures.

Although the Eurosceptic UK Independence Party enjoyed a surge in support, it is expected that it will only result in one Westminster MP. Douglas Carswell, who defected to UKIP and then won a by-election, held his seat.

>>Read: ‘Europe isn’t working’ says Cameron

UKIP leader Nigel Farage was predicted to come third in the race to win South Thanet. The final results were delayed until about 9AM GMT. Farage has said he would step down as UKIP leader, if he did not triumph in the constituency.

The loss of their most popular and high-profile politican as leader would be a big blow for UKIP, which did not repeat its triumph of last May’s European elections.

Brexit

Cameron has promised the in/out Brexit vote by 2017, if he was reelected. The Conservative London Mayor Boris Johnson, elected to Uxbridge as an MP, said this morning that it was time for the referendum.

“It wouldn’t just be good for Britain, but for the whole of Europe,” he told the BBC.

SNP leader Nicola Sturgeon has said that Scotland must not be taken out of the EU on the basis of an English vote. This morning she said that the results in Scotland could not be ignored in London.

>>Read: House of Lords report finds allegations of EU interference unfounded

With a clear mandate from Scotland, a vote to take the UK out of the EU could result in renewed calls for another Scottish independence vote.

Both Miliband and Cameron spoke of the need to reunite a divided United Kingdom.

But Conservative MEP Sajjad Karim said that another referendum would only happen if Brits voted to leave the EU.

EU reforms

Cameron’s victory will also see his fractious relationship with EU leaders continue. The Tory leader waged a bitter campaign to block the former Luxembourg Prime Minister and EU veteran Jean-Claude Juncker from becoming President of the European Commission.

He insisted that EU heads of states and government took a vote on the matter during an EU summit on 27 June last year, even though he did not have a blocking minority. He was predictably outvoted 26 to two by the leaders of other member states.

But his victory will add fresh impetus to his calls for EU reforms in areas such as immigration and freedom of movement, which will have added leverage becuase of the looming Brexit referendum.

>>Read: Conservatives lay out EU promises in manifesto

Jeff Bell runs the Finborough Arms pub in Kensington, London. He was granted a special licence to stay open all night for the elections.

The 36-year-old said that, as a small businessman, he was pleased with the Conservative victory. But he added, “I am shocked and surprised at the result, because I was managing my expectations.”

On the prospect of a Brexit referendum, Jeff said he hoped Britain could play a constructive role in EU reform.

“I find it hard to say that I would vote to exit the EU, but it is not impossible,” he added.

At time of publication, the Conservatives held 183 seats, Labour 181, the SNP 54, the Lib Dems six and UKIP one.