People in Britain - and around the world - reacted with shock today to the United Kingdom's decision to leave the European Union.

The vote, after a bitter campaign, split the country along several faultlines: old vs young; England and Wales vs Scotland and Northern Ireland; and people in northern England suffering economic hardship vs richer city dwellers in the south.

It went down to the wire before ending in a 52-48% win for Brexit in the early hours of this morning, prompting celebrations by Leave campaigners and their supporters for a move they said would make Britain stronger.

Most people in Scotland and Northern Ireland voted to remain while England and Wales opted to leave, raising questions over the future of the United Kingdom they all belong to.

The pro-Brexit side drew support from millions of voters who felt left behind by globalisation and blamed EU immigration for low wages and stretched public services.

David Cameron earlier announced that he will resign as Prime Minister following the outcome.

Mr Cameron said he accepted the decision of the electorate.

He said he would leave it to his successor to invoke Article 50 of the Lisbon Treaty, which kicks off the two-year process of negotiating a new trade relationship with the UK's former partners.

It will take at least two years of negotiations with the EU before the process of separation is complete.

European Commission President Jean-Claude Juncker said that Britain's decision to leave the EU was not the beginning of the end for the bloc.

Earlier, he reassured Britons working for the EU executive that their jobs are not at risk following the vote.

EU civil service jobs are generally restricted to EU citizens and Britons will lose that status once their country has completed its departure. 

German Chancellor Angela Merkel expressed "great regret" at the UK's decision to leave the European Union but insisted the bloc was "strong enough" to find the "right answers" to the challenges it faces.

Speaking in Berlin, she said the EU had contributed to peace on the continent, but that stability could not be taken for granted in a "world of turmoil".

Meanwhile, French President Francois Hollande said that Britain's vote to leave the EU was a "grave test for Europe" in view of the economic and financial consequences.

"The British vote poses a grave test for Europe, which must show solidity and strength in its response to the economic and financial risks," Mr Hollande said after meeting with his cabinet.

Government has contingency plan over Brexit - Kenny

Taoiseach Enda Kenny said that the Dáil will be recalled on Monday to discuss the impact of Brexit on Ireland.

He also said that the Government has a contingency plan to deal with the UK leaving the EU and that a summary of the key actions would be published. 

Enda Kenny

He added that Ireland is a strong, open and competitive economy and that the recovery is testament to the resilience of the economy. The Government would continue to focus on this growth, he said.

Stocks in free fall around the world

Brexit campaigners played down the financial turmoil unleashed by the result as global markets plunged and the pound fell against the dollar to levels last seen in 1985 on fears for the future of the world's fifth-largest economy.

In New York, the Dow Jones plunged more than 500 points in opening trade on Wall Street.

About five minutes into trade, the Dow Jones stood at 17,501, down 510 points (2.8%), while the broad-based S&P 500 fell 2.7% to 2,055 and the tech-rich Nasdaq Composite Index dropped 3.5% to trade at 4,738.

While off their earlier lows, European shares continue to suffer steep falls this afternoon as markets went into meltdown after the UK vote.

Barack Obama

In the US, President Barack Obama said the US relationship with both Britain and the European Union would endure in the wake of British voters' decision to leave the EU.

"The United Kingdom and the European Union will remain indispensable partners of the United States even as they begin negotiating their ongoing relationship," Mr Obama added.

Meanwhile, the Scottish Government will draw up legislation to allow a second independence referendum to be held, First Minister Nicola Sturgeon said.

While the UK as a whole voted to leave the European Union, Scots overwhelmingly opted to remain, with Ms Sturgeon declaring the result meant there had been a "significant and material change in the circumstances in which Scotland voted against independence" in 2014.

She said: "As things stand, Scotland faces the prospect of being taken out of the EU against our will. I regard that as democratically unacceptable."