It's official - Britain has made the historic decision to vote to leave the European Union.
No country has ever left the EU so this is when the real uncertainty begins.
We look at who could replace him and the other possible post-Brexit scenarios.
Boris to replace Cameron?
Robert Peston had predicted David Cameron's time in Number 10 was nearing an end as Leave emerged victorious.
Our political editor said it was "inconceivable" Mr Cameron would remain as prime minister, saying: "I can't see how the prime minister can stay in office for more than a few weeks when the biggest political decision he has ever taken has gone so spectacularly wrong - his authority has been fatally undermined."
But the aftermath of the defeat saw him step out in front of Number 10 and confirm he will make way for a new leader.
Mr Cameron's exit will trigger a Conservative leadership contest that could deepen divisions within the already fractured party.
Boris Johnson, the figurehead of the Leave campaign, is the early favourite.
The value of the pound plummeted to its lowest level in 31 years as the Leave campaign began to look the likely victors.
The dramatic fall was described as unprecedented by analysts who fear the situation will only get worse now Leave has won.
All eyes will be on Bank of England Governor Mark Carney, who will emerge as an important figure in the hours after a Leave vote.
Joel Hills, our business editor, said independence from the EU may come at the expense of British living standards.
"If fall in pound is sustained inflation will rise."
Article 50 is activated
Article 50 of the 2009 Lisbon Treaty is essentially the EU exit button - it allows a country to start formally withdrawing from the European Union.
Once Britain has activated this clause, it has two years to negotiate its departure with the remaining 27 members of the bloc.
Among the terms to be discussed include: trade tariffs and freedom of movement.
All terms would have to be agreed by the European council and parliament - which could prove incredibly complicated and difficult.
David Cameron had suggested he would look to push the exit button as soon as possible but Leave campaigners say informal negotiations with other countries should begin first.
They will want Mr Cameron's successor to take over exit negotiations.
Sounds complicated right? The process of getting Britain out the exit door may be fraught and problematic.
Second Scottish referendum?
Scotland - which voted to Remain - is essentially being taken out the EU "against its will".
This will potentially trigger another bid for independence and Nicola Sturgeon will now come under increased pressure to call a second independence referendum.
The SNP manifesto for May's Scottish Parliament election said there should be another referendum if there was a "significant and material" change in circumstances from the 2014 vote - such as Britain leaving the EU.
Alex Salmond, her predecessor, told ITV News he was "quite certain" Sturgeon would implement her manifesto.
"We've got a united country of Scotland who wants to be part of Europe."
Angus Robertson, the SNP leader at Westminster, has also said the result will spark a "constitutional crisis".
European leaders react
This vote to leave will trigger an outpouring of anger and dismay from across the continent.
It will also have a major impact on European leaders who are facing the rise of populist anti-EU parties in their own countries.
Our Europe Editor James Mates said Eurosceptics across the continent were "just itching for Britain to vote ‘Leave’ as the springboard for their own assault on Brussels".
Jacki Davis, a commentator on EU affairs, told ITV News that there is a "real fear" in Brussels of a "domino effect" now the UK vote has voted to leave.
"There are people here talking, and they do not exaggerate, about this being the beginning of the end."
The reactions of German Chancellor Angela Merkel and French President Francois Hollande will therefore be fascinating to watch.
What does Labour do?
David Cameron may not be the only political leader who could pay the price for the referendum result.
As Labour heartlands voted to leave the EU, the party's bitter infighting resurfaced.
Many Labour MPs blamed leader Jeremy Corbyn - who was accused of having half-hearted support for the bloc - for failing to convince its voters to back Remain.
His critics may now look to oust him.
An early general election?
Allegra Stratton, our National Editor, believes there will be a general election in the near future.
Jeremy Corbyn has said Labour is ready for a snap election and the Conservatives may want their new leader to assert his authority and gain a mandate for EU negotiations.
Amid all the uncertainty, one thing is for sure: this result has sent shockwaves across the country and Europe.
And it will have implications for the days, months and years to come.