This article is more than
8 year oldAfter discussing the vote to leave with other EU leaders, he said trade and security co-operation would be vital whatever the shape of future links.
But he said immigration was a "great concern" among UK voters and squaring this with access to the EU single market would be a "huge challenge".
Germany's Angela Merkel said the EU must "respect the result" of the vote.
But German politicians have insisted the UK cannot "cherry-pick" aspects of the EU.
Earlier on Tuesday, Chancellor Merkel said the UK must accept free movement if it wanted to retain access to the single market.
Mrs Merkel said the Brexit vote had been discussed "very intensively and deeply" at the dinner meeting with EU leaders.
"We all regretted the result and made clear that the legal procedure must be that the UK invokes Article 50.
"Mr Cameron said he would hand it over to the new government to do... we all agreed that before that point, there can be no formal or informal negotiations."
Mrs Merkel said Mr Cameron expressed how he had expected a different result in the referendum, but she added that "We are politicians; we can't spend a long time mourning".
She also said that "Publicly... we can see no way to turn this around. It's not a time for wishful thinking, but of contemplating the reality."
She added that talks would be "on the basis that we expect the representative of the UK to say what idea he has about withdrawing from the EU".
"The request to withdraw will say what sort of relationship the UK wants. But there can be no quasi-negotiations."
Mr Cameron had been explaining the outcome of Britain's referendum to the EU's other 27 leaders at a meeting of the European Council, expected to be his last after he announced his intention to stand down in the wake of the Leave vote.
He told reporters the discussions had been "calm, constructive and purposeful".
The PM, who has said it will be up to his successor to decide how to proceed with talks on the terms of Britain's separation from the EU, said there was "universal respect" for the UK's decision to leave despite a "tone of sadness and regret".
While the EU wanted more information about the UK's negotiating plans going forward and a "clear model appearing", he said there was an acknowledgement that this would take some time and "no great clamour" for talks to begin straight away.
The prime minister warned that intransigence over freedom of movement could scupper any chance of a UK-EU trade deal with whoever takes over from him, saying there was a "very great concern" over immigration "coupled with sovereignty and the ability to control these things".
He said that he wished he had won the referendum, but it was right to hold it to try to settle the question of the UK's role in the EU.
Mr Cameron said: "You fight for what you believe - if you win, good, If you lose, you have to accept the verdict."
Downing Street said his message to EU leaders was that if they want a close economic relationship with the UK after Brexit, they cannot "shy away" from the migration issue.
A government source said: "He believes that one of the key issues in the referendum campaign, and therefore why a lot of people voted to leave, is this sense that there was no control on the scale of immigration and freedom of movement. That was one of the factors."
Earlier on Tuesday, hundreds of pro-Remain supporters gathered outside Parliament to demonstrate about the consequences of Brexit.
And hundreds also turned out in Cardiff, at an event which included speeches from Plaid Cymru leader Leanne Wood and racial equality activist Shazia Awan.
Other rallies in Manchester and Oxford were abandoned amid fears about crowd sizes, and a protest in Liverpool was postponed until next week.
Newer articles
<p>The two leaders have discussed the Ukraine conflict, with the German chancellor calling on Moscow to hold peace talks with Kiev</p>