Scotland’s former first minister Alex Salmond has been branded “the slipperiest of characters” by David Cameron, with the ex-PM saying it would have “hurt beyond belief” if Scots had voted for independence.

In his forthcoming autobiography, For The Record, the former Conservative leader concedes allowing the 2014 referendum to take place was a “gamble” – although he said it would be a “much bigger gamble” to dismiss the issue.

After the SNP won an overall majority at Holyrood in 2011, Mr Cameron travelled to Edinburgh to negotiate the terms of the historic ballot.

The former prime minister said: “I went up to Edinburgh for my first negotiation meeting with the slipperiest of characters, Alex Salmond, Scotland’s first minister, in February 2012.

“I always used to say you had to count your fingers on the way out of a meeting with him.”

Mr Cameron had been at Balmoral for an audience with the Queen in the run-up to the referendum when a shock poll put Yes narrowly in the lead.

Days later, the Queen urged Scots to “think very carefully” about the vote,  with Mr Cameron saying he was “delighted” by her comments.

He wrote: “If I were the one who precipitated the end of our island story, it would hurt beyond belief.”

Former Scottish first minister Alex Salmond (Jane Barlow/PA)

Mr Cameron said there was “panic” when the turnout in the referendum – which took place almost exactly five years ago on September 18 2014 – was put at almost 85%, the highest in UK history.

He recalled: “After Clackmannanshire declared at 1.30am with a solitary majority for no, I went to bed but I didn’t sleep.

“The lead we were taking started closing overnight. But sure enough, after 4am the No votes kept rolling in.

“Two of the happiest hours of my life followed. Everything was going to be OK.”

Scots voted by 55% to 45% against independence, with Mr Salmond announcing within hours of the result being declared that he would be stepping down as SNP leader and first minister.

The former first minister said that Mr Cameron’s “comments about me seem rather mild compared to the venom he has reserved for his erstwhile Tory chums”.

He added: “The extract from his book shows how rattled David Cameron was in the final stages of the 2014 campaign, lying awake at night worrying about what the Queen would think of him if there was a Yes vote!

“In reality David wasn’t a great negotiator and the Scottish side achieved most of what we wanted from the Edinburgh Agreement of 2012, hence his petulance even now about the negotiations. Cameron’s response was to increasingly let George Osborne do his thinking for him.

“In the end Cameron squeaked through only by combining with the other unionist parties and promising Scots near federal powers in “The Vow”; the same type of powers which he previously had refused to even countenance as a possibility. Inevitably these promises were broken by Westminster, which is why five years on independence has become the majority position in Scotland.”