Britain is to leave the European Union after a nearly half a century plunging the country into unchartered political and economic territory and almost certainly spelling the end of David Cameron’s premiership.

With almost all the results declared voters backed Brexit by a margin of 52 to 48 per cent.

The outcome is also likely to spark a second independence referendum in Scotland that, unlike England and Wales, voted to remain in the EU.

Nicola Sturgeon said it the vote in Scotland “made clear” that it saw its future as part of the European Union.

Nigel Farage said Mr Cameron should resign “immediately”, while Labour also said that he should “consider his position”.

Nigel Farage: 'Let today be our independence day'

Markets reacted with alarm to the vote with the pound plunging against the dollar to levels not seen in more than thirty years. The FTSE was predicted to fall by around ten per cent.

One city analyst described the vote as "one of the biggest market shocks of all time".

6 ways Britain leaving the EU will affect you Show all 6 1 /6 6 ways Britain leaving the EU will affect you 6 ways Britain leaving the EU will affect you More expensive foreign holidays The first practical effect of a vote to Leave is that the pound will be worth less abroad, meaning foreign holidays will cost us more nito100 6 ways Britain leaving the EU will affect you No immediate change in immigration status The Prime Minister will have to address other immediate concerns. He is likely to reassure nationals of other EU countries living in the UK that their status is unchanged. That is what the Leave campaign has said, so, even after the Brexit negotiations are complete, those who are already in the UK would be allowed to stay Getty 6 ways Britain leaving the EU will affect you Higher inflation A lower pound means that imports would become more expensive. This is likely to mean the return of inflation – a phenomenon with which many of us are unfamiliar because prices have been stable for so long, rising at no more than about 2 per cent a year. The effect may probably not be particularly noticeable in the first few months. At first price rises would be confined to imported goods – food and clothes being the most obvious – but inflation has a tendency to spread and to gain its own momentum AFP/Getty Images 6 ways Britain leaving the EU will affect you Interest rates might rise The trouble with inflation is that the Bank of England has a legal obligation to keep it as close to 2 per cent a year as possible. If a fall in the pound threatens to push prices up faster than this, the Bank will raise interest rates. This acts against inflation in three ways. First, it makes the pound more attractive, because deposits in pounds will earn higher interest. Second, it reduces demand by putting up the cost of borrowing, and especially by taking larger mortgage payments out of the economy. Third, it makes it more expensive for businesses to borrow to expand output Getty 6 ways Britain leaving the EU will affect you Did somebody say recession? Mr Carney, the Treasury and a range of international economists have warned about this. Many Leave voters appear not to have believed them, or to think that they are exaggerating small, long-term effects. But there is no doubt that the Leave vote is a negative shock to the economy. This is because it changes expectations about the economy’s future performance. Even though Britain is not actually be leaving the EU for at least two years, companies and investors will start to move money out of Britain, or to scale back plans for expansion, because they are less confident about what would happen after 2018 AFP/Getty Images 6 ways Britain leaving the EU will affect you And we wouldn’t even get our money back All this will be happening while the Prime Minister, whoever he or she is, is negotiating the terms of our future access to the EU single market. In the meantime, our trade with the EU would be unaffected, except that companies elsewhere in the EU may be less interested in buying from us or selling to us, expecting tariff barriers to go up in two years’ time. Whoever the Chancellor is, he or she may feel the need to bring in a new Budget Getty Images

The former Liberal Democrat leader tweeted “God help our country”. The German Finance Minister Wolfgang Schäuble said it was a “sad day for Europe”.

But Gisela Stuart, the Labour chairwoman of Vote Leave, called for calm.

“In the long run both Europe and the United Kingdom will emerge stronger as a result,” she said.

The unofficial result was confirmed just after 4.40am in the morning after a surge in support for leaving the EU confounded predictions made just hours before polls closed.

Middle England joined forces with the country’s industrial heartlands of the North East and North West to comprehensively reject warnings of economic Armageddon and vote to leave.

Support for remain was strongest in London and Scotland but with cities like Sheffield and Birmingham joining with Canterbury, Torbay and Peterborough in favour of Brexit momentum drifted away from the remain camp.

The result will now trigger a formal process of British withdrawal from the European Union. A planned meeting of European leaders next week in Brussels will now become an emergency Brexit summit.

The Ukip leader Nigel Farage claimed victory saying “dawn was breaking on an independent United Kingdom”. Provocatively he said he hoped the vote would be a catalyst for the complete collapse of the European Union.

The polling expert Professor John Curtice said Labour supporters appeared to have defied pleas from their party to support Britain’s membership of the EU – tipping the scales in favour of Brexit.

With 374 out of 382 local authority areas declared the Leave campaign had won 52 per cent of the vote compared to 48 per cent for remain. Around one million votes separated the two sides with a turnout of over seventy per cent,

“This is a seismic moment for our country,” said the former shadow Business Secretary Chuka Umunna.

“It will be catastrophic for Britain. It is just so, so terrible,” said Keith Vaz the chairman of the House of Commons Home Affairs Select Committee.

But Andrea Leadsom, the Tory Energy Minister and Vote Leave supporter said the dire predictions of economic doom did not need to come to pass.

"I think what we will now want to do is take a calm and rational look at exactly what the next steps are," she told BBC News.

"We need to reflect on what the alternatives are but at the same time to look at the possibilities of a presumption of continuity for the free trade agreements that we are already party to as a member of the EU and all of the trade negotiations both with the EU and with other countries that at the moment we are unable to trade with directly."

The result confounds a string of polls yesterday suggesting a comfortable win for remain.

A YouGov poll of 5000 people released at ten pm yesterday put Remain on 52 per cent and Leave on 48.

Senior Labour figures including Ed Miliband and Yvette Cooper suggested that the scale of support for Leave was fuelled by discontent with the way the country was heading on issues like wages, jobs and opportunities for the young.

"It's a nation divided and the PM will have a big responsibility - to show he understands what people are saying on the Leave side of the argument," said former Labour leader Mr Miliband.

The moment Britain officially voted to leave the EU

"Labour faces that responsibility too. As far as Labour voters are concerned, there are two issues. There is obviously immigration, but beneath that there is a whole set of issues about people's lives and the fact that they don't feel politics is listening to them.

Shadow foreign secretary Hilary Benn told the BBC that he believed David Cameron would have to resign.

"As far as the Prime Minister is concerned I don't see how he is going to remain in his job for very long at all,” he said.

"I think it's very hard for him in those circumstances to remain. If you are the Prime Minister, you've called this referendum, you've laid your reputation on the line and your arguments, I think it's going to be very hard."

Lib Dem former Cabinet minister Sir Vince Cable described holding the referendum as a "very bad call" by the Prime Minister, who failed to understand what happens "when you just throw the cards in the air".

Shadow chancellor John McDonnell told BBC News that the Bank of England would have to intervene to prop up the pound.