David Cameron is to resign as Prime Minister by October after Britons voted in a referendum to leave the European Union.

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

He said he will continue as Prime Minister with his cabinet for the next three months.

With his voice appearing to break, Mr Cameron said: "I love this country and I feel honoured to have served it."

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.

Mr Cameron had called the referendum in 2013 in a bid to head off pressure from local eurosceptics, including within his own party, and had led the campaign for a Remain vote.

David Cameron - A Profile

Mr Cameron's decision has been described as "truly shocking" and "a sad day for the country" by his cabinet colleagues.

Speaking on the BBC Radio 4 Today programme, Northern Secretary Theresa Villiers said: "It's truly shocking news, I think it's deeply saddening.

"As I was just saying only a few minutes ago, I would very much have preferred David Cameron to be steering this country through the next few years.

"I entirely respect his decision but I think it is a sad day for the country that he has decided to stand down."

Her sentiments were echoed by Defence Secretary Michael Fallon, who said the PM believed he was doing the "honourable thing" after the referendum vote.

Alex Salmond, who stood down as Scotland's first minister after failing to secure independence in a referendum vote in 2014, said the PM's resignation was "inevitable".