David Cameron has confronted Tory opponents of gay marriage head on by coming out in favour of gay weddings in churches.
The prime minister said on Friday that he was a "massive supporter of marriage" and did not want gay people to be "excluded from a great institution".
The government has promised any religious organisation that does not want to conduct same-sex wedding ceremonies will not be forced to do so. But Cameron has indicated churches that do want to host the ceremonies will be allowed to.
"Let me be absolutely 100% clear, if there is any church or any synagogue or any mosque that doesn't want to have a gay marriage it will not, absolutely must not, be forced to hold it. That is absolutely clear in the legislation," he said.
"Also let me make clear, this is a free vote for Members of Parliament but personally I will be supporting it."
Cameron's intervention means that all three party leaders have now spoken out in favour of allowing religions to host same-sex wedding ceremonies.
Last month it was reported that over 100 Tory MPs plan to oppose the prime minister by voting against coalition plans to bring in gay marriage.
Reacting to the news that Cameron supports gay weddings in church, senior Tory MP Mark Pritchard said he feared exemptions for places of worship in the same-sex marriage Bill were likely to be ruled unlawful by the Supreme Court or the ECHR "within months" despite government assurances it would not be.
"Same-sex marriage Bill now exercises Tory grassroots as much as lack of progress on a referendum. Number 10 should hear the alarms bells," he said on Twitter.
And he suggested the introduction of gay marriage would "undo much of the good outreach work the [Conservative] Party has done with Muslim, Sikh, and Hindu communities".
Tory MP Stewart Jackson told The Huffington Post UK half of the parliamentary party was opposed to gay marriage and the prime minister was "in a very weak position".
"One of his strong arguments was that faith communities would have their sincere theological opposition respected," he said.
"Not only is that not the case, on top of that he seems to have disregarded many thousands of people who took part in the consultation and have had their views put in the dust bin."
Jackson said the plan to allow churches to host gay weddings was a "recipe for disaster and division in the Conservative Party" and predicted the government would have a tough time getting it Bill through the House of Lords.
However former Tory home office minister Nick Herbert, who quit the government in September, said it was a "really positive step" to allow religious groups to conduct same sex marriages at the same time as preventing them being forced. "Equal marriage + religious freedom," he tweeted.
In the face of opposition from his own backbenchers the prime minister offered his MPs a free vote on the issue, meaning they are free to vote against him without consequence.
As well as many backbench MPs, the vote is also likely to see some ministers, including Northern Ireland secretary Owen Paterson, oppose the plan.
Opposition from Tory MPs means Cameron may have to rely on the support of Lib Dem and Labour MPs to push the bill through the Commons.
Culture secretary Maria Miller is due to announce the government's response to the gay marriage consultation on Thursday.
The internal Tory fight over the plans could come to a head sooner than initially thought, amid reports the government plans to fast track legislation in the new year in order to prevent the row rumbling on until 2015.
Gay rights campaign welcomed the reports that the prime minister planned to back religious gay weddings.
Ruth Hunt, the director of public affairs, Stonewall told the Huffington Post UK: "We’ve long campaigned to allow religious organisations to conduct same-sex marriages if they wish to do so.
"This is an important issue of religious freedom and many gay people of faith will welcome proposals allowing them to celebrate their marriages with their pastors and fellow congregants."
Cameron's position was also welcomed by the Unitarian and Free Christian Churches who support gay marriage.
Derek McAuley, from the churches, said unitarians said they were "hopeful that this will mean we will be free to conduct same-sex marriages in our places of worship".
"We don't expect Parliament to force other churches or individual clergy, who may disagree with us, to marry same-sex couples if they do not wish to do so," he said.
"However, we do not consider that our wishes should therefore be set aside. We claim the right to do so in line with our own deeply held convictions about the inherent worth of all individuals and for public recognition of relationships."
However, the Church of England reiterated its opposition to the move. In a statement, it said: "The uniqueness of marriage is that it embodies the underlying, objective, distinctiveness of men and women.
"To change the nature of marriage for everyone will be divisive and deliver no obvious legal gains given the rights already conferred by civil partnerships."
Colin Hart, campaign director for the Coalition For Marriage, which opposes same-sex marriage, said the decision to press ahead with changes was "deeply disappointing and regrettable".
"What is even more alarming is the PM has gone back on his promises that churches will be protected. The suggestion that by creating an 'opt-in system' you somehow prevent churches, mosques and synagogues being sued is risible," he added.