David Cameron ignored the almost “universal advice” from Conservative colleagues to drop his support for legalising gay marriage – despite coming close to being ousted as Tory leader over the issue, according to Lord Ashcroft’s biography of the Prime Minister, Call Me Dave.

Even Mr Cameron’s mother, Mary, who is a magistrate, said “I know, but David just won’t be told” when asked about the negative reaction to the idea from Tory voters, the Daily Mail, which is serialising the book, reported.

MPs voted to legalise gay marriage in February 2013 but fewer than half of Conservative MPs backed Mr Cameron on the issue and he relied on support from the Liberal Democrats and Labour.

Graham Brady, Tory MP for Altrincham and Sale West and chairman of the backbench 1922 Committee, was quoted as saying: “Pretty much the universal advice of any colleague who spoke to [Cameron] on the subject was to drop it, whatever their personal view.

“A lot of colleagues were being driven to despair by the loss of support. There were people with small majorities, who were losing all of their activists.”

Mr Brady said there was a “real danger point” for Mr Cameron’s leadership before the vote in parliament as MPs came under pressure from their constituency associations.

Former Defence Minister Nicholas Soames said he thought Mr Cameron was unaware of how much opposition there was.

“I really believe that had he known the scale of the aggro, he wouldn’t have done it,” he said, adding he was “utterly convinced” that the Prime Minister had been right.