David Cameron has announced he will quit as Prime Minister by October after a humiliating defeat in the referendum which ended with a vote for Britain to leave the European Union.

The Prime Minister announced his decision outside 10 Downing Street minutes after the markets opened with carnage in the City of London.

More than £100 billion was wiped off the FTSE 100 as the index fell more than 7%, while the pound also crashed 8% against the US dollar.

Flanked by wife Samantha, Mr Cameron said he had informed the Queen of his decision to remain in place for the short term, but hand over to a new Prime Minister by the time of the Conservative annual conference.

"The British people have voted to leave the European Union and their will must be respected," said Mr Cameron. "The will of the British people is an instruction that must be delivered."

His voice breaking, Mr Cameron said: "I love this country and I feel honoured to have served it and I will do everything I can in future to help this great country succeed."

Mr Cameron said he accepted the decision of the electorate, which voted by 52% to 48% to quit the EU.

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.

"The country requires fresh leadership to take it in this direction," said Mr Cameron. "I will do everything I can as Prime Minister to steady the ship over the coming weeks and months, but I don't think it would be right for me to try to be the captain that steers our country to its next destination."

His announcement will trigger a battle for the Conservative leadership - and the keys to Number 10 - likely to feature Brexit standard-bearer Boris Johnson taking on figures such as Home Secretary Theresa May, who took a low profile in the referendum campaign.

In Brussels and capitals around Europe, political leaders and officials went into emergency meetings to plan a response to the UK's seismic decisions, which sent shockwaves around the world.

European Council president Donald Tusk said there was "no way of predicting all the political consequences of this event, especially for the UK" and called for calm.

"It is a historic moment but for sure not a moment for hysterical reactions," he said.

Mr Cameron said he had summoned the Cabinet to meet on Monday, the day before he goes to Brussels for a summit where he will "explain the decision the British people have taken and my own decision" to leaders of the remaining 27 member states.

Announcing his resignation after six years as PM - and just 13 months after securing an absolute majority for the first time - was "not a decision I have taken lightly", said Mr Cameron.

But he added: "I do believe it is in the national interest to have a period of stability and then the new leadership required.

"There is no need for a precise timetable today, but in my view we should aim to have a new prime minister in place by the start of the Conservative Party conference in October."

He went on: "The negotiation with the European Union will need to begin under a new prime minister and I think it is right that this new prime minister takes the decision about when to trigger Article 50 and start the formal and legal process of leaving the EU."

Remain supporters had to respect the people's decision and "help to make it work", said the PM.

A clearly emotional Mr Cameron said he stood by his assertion that the UK could "find a way" to survive outside the EU.

"Now the decision has been made to leave we need to find the best way and I will do everything I can to help," he said.

Minutes after the PM's statement, Bank of England governor Mark Carney announced he was making £250 billion available to support markets, as he pledged that the Bank "will not hesitate to take additional measures as required as markets adjust and the UK economy moves forward".

Even as polling stations closed on Thursday night, most observers, pollsters and bookmakers were expecting victory for Remain, albeit by the narrowest of margins.

Ukip leader Nigel Farage even came close to conceding defeat, admitting he believed that Remain had "nicked it" and vowing to fight on for withdrawal from the EU, while senior pro-Brexit Tories including Mr Johnson and Michael Gove signed a letter calling on the PM to stay on regardless of the result.

But emphatic early victories in cities such as Sunderland and Swindon made clear the momentum was all on the Brexit side. As dawn arrived, it was clear that Leave had secured enough support in the English shires and former Labour strongholds in the North, Wales and Midlands to sweep aside strong Remain performances in London, Scotland and Northern Ireland.

With ballots counted in all 382 polling areas - including Gibraltar, which voted overwhelmingly to stay in the EU - Leave received 17,410,742 votes (51.9%) against 16,141,241 (48.1%) for Remain.

The result in Scotland is certain to create massive pressure for a second independence referendum. Former Scottish National Party leader Alex Salmond said he was "quite certain" that an effort to drag Scotland out of the EU against its will would lead to the invocation of a manifesto promise to stage another ballot if there was a "significant and material" change in circumstances from the 2014 vote.

First Minister Nicola Sturgeon said Scotland had delivered a "strong, unequivocal vote" making clear that "the people of Scotland see their future as part of the European Union".

A jubilant Mr Farage declared June 23 "our independence day" to cheers from ecstatic supporters as the sun rose.

But there were recriminations among Labour supporters, with influential backbench MP John Mann - one of a handful to back a Brexit vote - calling for a change in the party's direction, particularly on immigration policy. Senior Labour figures including Ed Miliband sought to cast the result as a protest against the effects of austerity as much as an expression of desire to leave the EU.

The Bassetlaw MP said the strong showing for Brexit in former heartland areas showed the party was "out of touch" with traditional voters who were "sick to death" with what they were being offered.

Foreign Secretary Philip Hammond did not rule out an emergency summer budget to respond to the damage the Government expects the Brexit vote to inflict on the UK economy. Ahead of the referendum, Chancellor George Osborne warned that a Leave vote might result in higher taxes, lower public spending or both, and Mr Hammond said that the Government's fiscal consolidation programme would now become "more difficult".

The Foreign Secretary said the markets' response to the vote showed that "we don't control everything", adding: "We can't just ignore the economic facts. We have to respond to them. We will have to look at the situation, see where the market settles, see what the immediate impact on the economy is and decide how best to proceed."

Speaking at the Electoral Commission's main counting centre in Manchester, Vote Leave chairman Gisela Stuart said the Brexit vote was "our opportunity to take back control of a whole area of democratic decisions".

All political leaders should now "reflect on whether they have accurately gauged the people's desire to govern themselves", she said.

The German-born MP said a calm cross-party effort was now needed to implement the voters' decision "in the best long-term interests of this country". And she broke into her native tongue to assure other EU nations that Britain would remain an "open, welcoming" country which would continue to co-operate with its former partners.

Labour leader Jeremy Corbyn called on the PM to invoke Article 50 immediately, but leading Leave campaigners including Andrea Leadsom and Liam Fox said it was right to hold off.

Some 72.2% of the 46,500,001 eligible voters turned out at polling stations, said the Electoral Commission. The total turnout of 33,568,184 was just short of the highest ever participation in a UK general election, in 1992.