Britain is due to leave the EU on October 31. (Reuters file photo)

Former British prime minister David Cameron said Friday he had no regrets about launching the Brexit referendum but accused current PM Boris Johnson of behaving "appallingly" during the pre-vote campaigning.

Cameron, 52, who led the failed Remain campaign for Britain to stay in the European Union, told The Times newspaper that the tortuous Brexit negotiations were "painful to watch" -- and losing office left him "hugely depressed".

Prime minister for six years, Cameron has largely kept his counsel since he left office following the 2016 Brexit referendum.

His long-awaited memoir, "For The Record", is due out on Thursday.

Cameron said current Prime Minister Boris Johnson -- an old schoolfriend -- behaved "appallingly" during as head of the successful Leave campaign ahead of the referendum.

The former premier said a no-deal Brexit would be a bad outcome and that he would have backed the withdrawal agreement rejected by MPs.

Britain is due to leave the EU on October 31.

Cameron told The Times that a referendum on Britain's relationship with the EU had long been promised by politicians and the bitter divisions between Leavers and Remainers now gripping Britain were there long before the seismic vote.

"The country was divided whether we should be in the EU before the referendum," Cameron said.

"This issue needed to be addressed and I thought a referendum was coming, so better to try to get some reforms we needed and have a referendum.

"But I accept that, you know, that effort failed. I do understand some people are very angry because they didn't want to leave the EU. Neither did I."

Fractured friendships

The book contains two chapters logging his regrets over his pre-referendum negotiations with other EU leaders, and over the campaign itself.

"Every single day I think about it, the referendum and the fact that we lost and the consequences and the things that could have been done differently, and I worry desperately about what is going to happen next," said Cameron.

"It's painful for the country and it's painful to watch."

Cameron said Johnson had been torn over whether to back Leave or Remain but was tempted by the chance to lead the Leave camp -- and was stunned to end up winning.

Johnson and Brexit no-deal planner Michael Gove, who had been a Cameron loyalist, led the Leave campaign.

In his book, Cameron writes that the pair behaved "appallingly".

"They were trashing the government of which they were a part, effectively," Cameron told The Times.

"I've spoken to the prime minister a little bit, mainly through texts, but Michael was a very good friend. So that has been more difficult," he said.

Cameron said Johnson's recent move to expel anti-no-deal MPs from the governing Conservative Party and shutting down parliament for five weeks had rebounded.

"I didn't support either of those things. Neither do I think a no-deal Brexit is a good idea," he said.

Cameron said a second referendum might yet take place as a way to break the Brexit impasse.

"You can't rule things out right now because you've got to find some way of unblocking the blockage," he said.