Former prime minister David Cameron rang European leaders and then US president Barack Obama to apologise for his ultimately failed strategy to keep Britain in the European Union.

The Conservative wrote that he was “sad to leave office but even more sad that Britain would be leaving the EU” in his memoir which is being serialised in The Times ahead of its publication on Thursday.

Another revelation in the book, titled For The Record, was that current PM Boris Johnson asked whether Michael Gove was “a bit cracked” after the Brexiteer betrayed him during the 2016 Tory leadership race.

Writing about the morning after the Brexit referendum, in which 52% of people voted to leave the 28 member bloc, Mr Cameron said he was aware of the “enormity of what happened” and that it would “stay with me for the rest of my life”.

Read more: Cameron says second Brexit referendum 'cannot be ruled out'

He added: “There were phone calls with the other first and deputy first ministers. I spoke to European leaders and to Obama. To each I said the same thing: ‘I had a strategy to keep Britain in the EU. I executed the strategy. It didn’t work. I’m sorry.'”

“As it awaited its next occupants, Downing Street became an eerie place. Power was fading like a dimming lightbulb.

“Pre-arranged commitments in my diary kept me busy, but I was beginning to feel like the political equivalent of The Walking Dead.”

The Conservative former prime minister has also recalled the fraught battle to replace him in Number 10 in his memoir.

Mr Gove initially supported Mr Johnson’s campaign but then dramatically withdrew his backing and announced he would stand himself – leading the now-PM to quit the contest.

As Chancellor of the Duchy of Lancaster, Mr Gove is now responsible for no-deal Brexit preparations in Mr Johnson’s Government, and the revelation could put pressure on his relationship with the PM.

The 2016 leadership battle was eventually won by Theresa May, and Mr Cameron revealed in the book how he secretly encouraged Gavin Williamson to help her campaign, according to The Times.

Read more: Gordon Brown blames 'lazy' David Cameron for Brexit

In extracts from the book published over the weekend, Mr Cameron took aim at Mr Gove, describing him as a “foam-flecked Faragist”.

He said Mr Johnson wanted to become the “darling” of the Tory party and “didn’t want to risk allowing someone else with a high profile – Michael Gove in particular – to win that crown”.

Mr Cameron said the Prime Minister “didn’t believe” in Brexit and only backed the Leave campaign to further his career.

“The conclusion I am left with is that he risked an outcome he didn’t believe in because it would help his political career,” he wrote.