David Cameron at 2013 conferecne
David Cameron arrives in Manchester for the annual Conservative Party conference.

David Cameron expressed regret at alienating grass roots support by pushing through legislation allowing gay couples to marry, a new book reveals.

"If I'd known what it was going to be like, I wouldn't have done it" Cameron said in a private conversation, according to Matthew D'Ancona's book In It Together, an inside account of the coalition government.

Many Tory voters and some backbenchers were fiercely opposed to the bill, which became law in July 2013: 136 Conservatives voted against the legislation in parliament, outweighing the 127 who voted in its favour.

The bill passed with the support of Labour and Liberal Democrat MPs.

It is believed to have prompted scored of disillusioned Tories to vote for the UK Independence Party (Ukip).

"Behind the scenes, Cameron would later concede that his political antennae had failed him in this instance; he had lost contact with his own tribe," writes D'Ancona.

"In his bleaker private moments, Cameron became savagely self-critical about his misreading of the party on gay marriage. 'This is down to me,' he told one ally. 'If I'd known what it was going to be like, I wouldn't have done it.'"

"Months after the vote, he was still writing dozens of letters to activists and constituents seeking to allay their fears and to reassure them that what he was doing was authentically Conservative, and not a betrayal of the party's most sacred beliefs. 'I want this sorted out by July,' he told his advisers."

Today Cameron denied having made the remarks, and said that that gay couples would be entitled to the £200 extra per year that the new tax break would give married couples.

Speaking on the BBC's Andrew Marr Show, Cameron said: "I don't regret it. Britain is a more equal and fairer country for having done it.

"It's certainly true to say that this is an important change. I don't think I expected quite the furore that there was.

"I'm not sure perhaps at the beginning we got across to people that this was about marriages that could take place in register offices, that this was not going to change what happened in church, mosques or synagogues."

Religious organisations were among those who opposed the bill.

A Conservative think-tank has warned that the Conservatives face an "existential crisis", and that party membership has halved under Cameron.

Ahead of the party's conference in Manchester this week, David Davis MP, who ran against Cameron for the party leadership in 2005, said that the Conservatives need to reconnect with its core support.

"We need to do better as a party at having a two-way conversation between the grass roots membership on the one hand and the leadership and professional management of the party on the other," he said.

"The party conference shows just how much this conversation has broken down. Members no longer have the opportunity to interact and make speeches in the main conference hall."