Media playback is unsupported on your device Media caption EU vote: David Cameron says the UK "needs fresh leadership"

Prime Minister David Cameron is to step down by October after the UK voted to leave the European Union.

Speaking outside 10 Downing Street, he said "fresh leadership" was needed.

The PM had urged the country to vote Remain but was defeated by 52% to 48% despite London, Scotland and Northern Ireland backing staying in.

UKIP leader Nigel Farage hailed it as the UK's "independence day", while Boris Johnson said the result would not mean "pulling up the drawbridge".

Scottish First Minister Nicola Sturgeon said she was "absolutely determined" to keep Scotland in the EU so a second Scottish independence referendum was now "highly likely".

German chancellor Angela Merkel expressed "great regret" at the outcome, and EU chiefs said they expected the UK to begin negotiations to leave "as soon as possible, however painful that process may be".

But Boris Johnson, the ex-London mayor and public face of Vote Leave who is now a front-runner to be next prime minister, said there was "no need for haste" about severing the UK's ties.

Media playback is unsupported on your device Media caption Boris Johnson: "There is no need for haste"

He said voters had "searched in their hearts" and the UK now had a "glorious opportunity" to pass its own laws, set its own taxes and control its own borders.

Another leading Leave campaigner, Labour's Gisela Stuart, said the UK would be a "good neighbour" when it left the EU.

The pound fell to its lowest level against the dollar since 1985 as the markets reacted to the results.

The slide halted when the Bank of England said it stood ready with £250bn of extra funding to ensure market stability. But the pound remains 8% down against the dollar, and 6% lower against the euro.

Flanked by his wife Samantha, Mr Cameron announced shortly after 08:15 BST that he had informed the Queen of his decision to remain in place for the short term and to then hand over to a new prime minister by the time of the Conservative conference in October.

He would attempt to "steady the ship" over the coming weeks and months, but that it would be for the new prime minister to carry out negotiations with the EU and invoke Article 50 of the Lisbon Treaty, which would give the UK two years to negotiate its withdrawal, he said.

"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."

Area-by-area in maps: See how people voted

Bank of England governor Mark Carney said UK banks' "substantial capital and huge liquidity" allowed them to continue to lend to businesses and households.

Chancellor George Osborne said he had briefed G7 finance ministers about the consequences of the vote.

On Twitter, he said it had been a "hard-fought campaign" and while it was not the outcome he wanted, "I will do all I can to make it work".

The referendum turnout was 71.8% - with more than 30 million people voting - the highest turnout at a UK-wide vote since 1992.

Mr Farage - who has campaigned for the past 20 years for Britain to leave the EU - told cheering supporters: "This will be a victory for ordinary people, for decent people."

Labour leader Jeremy Corbyn, who called for the UK to remain in the EU but was accused of a lukewarm campaign, said poorer communities were "fed up" with cuts and felt "marginalised by successive governments".

There have been calls for him to consider his position after some of the strongest votes to leave the EU came from traditional Labour heartlands.

Senior backbencher Dame Margaret Hodge has tabled a motion of no confidence, which has the support of eight other Labour MPs, urging Mr Corbyn to resign. The motion could be debated and voted on by Labour MPs next week.

Lib Dem leader Tim Farron said Labour's leader had been "utterly gutless" in the way he approached the campaign.

But major unions, which fund the party, have urged Labour MPs not to create a leadership crisis.

Shadow chancellor John McDonnell said his party needed to "gear up" for a possible snap election and that he was "disappointed" at Dame Margaret's intervention.

What happens next?

Saturday

Nicola Sturgeon to hold a cabinet meeting at Holyrood

Monday

Prime minister to chair a Cabinet meeting

Executive of backbench 1922 committee of Conservative MPs to draw up the timetable for the Conservative leadership contest

MPs to return from Parliamentary recess for sitting in afternoon

Parliamentary Labour Party to discuss a motion of no confidence in Jeremy Corbyn, if chairman allows

Tuesday

European Parliament to hold an emergency session to discuss referendum result

EU Council meeting: national leaders will hold a two-day summit

If motion of no confidence in Jeremy Corbyn is accepted, Labour MPs to hold secret ballot on his future

Wednesday

Following the EU Council meeting, 27 leaders meet, without Mr Cameron round the table

Media playback is unsupported on your device Media caption Boris Johnson: "There is no need for haste"

Image copyright AFP/Getty Image caption Samantha Cameron looked on as the PM announced he was stepping down

Image copyright PA Image caption Remain campaigners looked glum as the result became clear overnight...

Image copyright AP Image caption As Leave campaigners celebrated

Image copyright AP Image caption German Chancellor Angela Merkel expressed "great regret" at the result

Image copyright Reuters Image caption Scottish first minister Nicola Sturgeon said a second independence referendum was "on the table"

Mr Johnson and fellow Leave campaigner Michael Gove paid tribute to Mr Cameron as they addressed Vote Leave supporters in London alongside Ms Stuart.

Mr Johnson said the UK was "no less united... nor indeed any less European" following the decision to leave the EU.

Meanwhile, at a press conference in Edinburgh, Ms Sturgeon said a second Scottish referendum was "on the table" and that the Scottish government would prepare legislation to enable one.

Media playback is unsupported on your device Media caption Nigel Farage: "Dawn is breaking on an independent United Kingdom"

The European Parliament is to hold an emergency session on Tuesday to discuss the referendum result.

On Twitter, EU Parliament president Martin Schulz called for a "speedy and clear exit negotiation".

A less than united Kingdom

Mark Easton, BBC home editor

Image copyright Reuters

The EU referendum has revealed an ancient, jagged fault line across the United Kingdom. It is a scar that has sliced through conventional politics and traditional social structures, and it is far from clear whether the kingdom can still call itself united.

The referendum was ostensibly about membership of the European Union. But voters took it to be asking a different question: what kind of country do you want Britain to be?

Yesterday seemed to offer a fork in the road: one path (Remain) promised it would lead to a modern world of opportunity based on interdependence; the other (Leave) was advertised as a route to an independent land that would respect tradition and heritage.

Which path people took depended on the prism through which they saw the world.

Read more from Mark

Britain is set to be the first country to leave the EU since its formation - but the Leave vote does not immediately mean Britain ceases to be a member of the 28-nation bloc.

That process could take a minimum of two years, with Leave campaigners suggesting during the referendum campaign that it should not be completed until 2020 - the date of the next scheduled general election.

Image copyright AP Image caption Traders in Tokyo monitor exchange rates

Once Article 50 has been triggered a country can not rejoin without the consent of all member states.

Mr Cameron previously said he would trigger Article 50 as soon as possible after a Leave vote but Mr Johnson and Mr Gove, who led the campaign to get Britain out of the EU, have said he should not rush into it.

They also said they wanted to make immediate changes before the UK actually leaves the EU, such as curbing the power of EU judges and limiting the free movement of workers, potentially in breach of the UK's treaty obligations.

The government will also have to negotiate its future trading relationship with the EU and fix trade deals with non-EU countries.

In Whitehall and Westminster, there will now begin the massive task of unstitching the UK from more than 40 years of EU law, deciding which directives and regulations to keep, amend or ditch.

Media playback is unsupported on your device Media caption An angry crowd booed Boris Johnson as he left his north London home

The Leave campaign argued during a bitter four-month referendum campaign that the only way Britain could "take back control" of its own affairs would be to leave the EU.

Leave dismissed warnings from economists and international bodies about the economic impact of Brexit as "scaremongering" by a self-serving elite.

The CBI said many businesses would be concerned about the referendum result.

It said "the urgent priority now is to reassure the markets", but warned against "rushed decisions".

Find the result in your area