Gay weddings moved a step closer on Monday evening after David Cameron was forced to accept Ed Miliband's help to defeat an attempt by backbench Tory MPs, who complained about the "aggressive homosexual community", to derail the legislation.

Anti-gay marriage Conservatives had tabled an amendment to the Marriage (Same Sex Couples) Bill that, if passed, would have introduced civil partnerships for heterosexuals at the same time as gay marriage.

However the government had warned that to do so could cost up to £4bn and significantly delay the implementation of the entire bill. A vote in the Commons saw the amendment overwhelmingly defeated by 375 votes to 70.

Pro-gay marriage campaigners cautioned MPs that the amendment, tabled by Tim Loughton, was a cynical attempt to kill the legislation rather than a genuine desire to allow straight couples to have civil partnerships in the interets of equality.

On Monday morning it appeared as if Loughton and his colleagues would be successful after the Labour Party, which backs gay marriage, indicated it would vote with the Tory backbenchers to defeat the government and secure equal civil partnerships.

However Labour's shadow equalities minister Yvette Cooper came to an agreement with culture secretary Maria Miller that will see the government launch a consultation into expanding civil partnerships without the risk of scuppering the gay marriage bill.

Following the vote Miller said: "We are pleased that the House has accepted our amendment offering a review of civil partnerships. We feel that a review is the right way forward, and that no changes should be made to civil partnerships without being fully thought through."

Writing for The Huffington Post UK, the culture secretary said the Conservative Party should be "proud" to enact gay marriage.

"Far from being a radical departure, equal marriage is simply one more in a long line of reforms which have strengthened marriage, ensuring it remains as relevant to our society as it ever was," she said. "Marriage embodies the principles of love, loyalty and commitment - all vital components of a strong society. Marriage brings stability and it binds us together. It makes our families stronger."

But many Tory MPs sat behind her in the Commons disagreed. Former Tory defence minister Sir Gerald Howarth suggested gay rights had gone too far. He criticised the "aggressive homosexual community" who he said saw gay marriage as "a stepping stone to something even further".

And Conservative Edward Leigh said the gay marriage bill was an example of the "outlandish views of the loony left" having taken over the government.

Gay marriage has split the Conservative Party down the middle. And some of its most vocal advocates as well as its most strident critics come from the Tory benches.

Former Conservative police minister Nick Herbert attacked anti-gay marriage Tory MPs who voted for the Loughton amendment for displaying "a faux attchment to equality".

"There are people who are breathing the word equality for the first time. It sticks frankly in the craw of many of us to be lectured about equality by a whole group of people who have been opposing this bill and opposing equality including civil partnerships," he told the Commons.

The vote came as a new poll from Survation showed Ukip trailing the Conservatives by just two per cent. The survey put the Tories on 24%, down five points, Labour on 35%, down one point, the Liberal Democrats on 11%, down one point, and Ukip on 22%, up six points.

The squeeze in suport for the Tories came as David Cameron tried to quell anger in the grassroots of his party over reports the co-chairman of the party, Lord Feldman, described activists as "swivel-eyed loons" who forced MPs to adopt hardline stances.

The peer, who was not named in newspaper reports, was forced to deny making the comments after intense internet speculation.

In his letter the prime minister wrote: "We have been together through good times and bad. This is more than a working relationship; it is a deep and lasting friendship."

"I am proud to lead this party. I am proud of what you do. And I would never have around me those who sneered or thought otherwise. We are a team, from the parish council to the local association to Parliament, and I never forget it."

MPs will hold a second day of debate on the gay marriage legislation on Tuesday before it moves to the House of Lords.

Related on HuffPost:

Loading Slideshow...
  • People celebrate outside the Parliament after lawmakers passed the "marriage equality project" in Montevideo, Uruguay,Wednesday, April 10, 2013. Their vote makes Uruguay the third country in the Americas after Canada and Argentina to eliminate laws making marriage, adoption and other family rights exclusive to heterosexuals. In all, 11 other nations around the world have already taken this step. (AP Photo/Matilde Campodonico)

  • People celebrate in parliament after lawmakers voted to legalize gay marriage in Montevideo, Uruguay,Wednesday, April 10, 2013. President Jose Mujica's ruling Broad Front majority is expected to put the law into effect within 10 days. (AP Photo/Matilde Campodonico)

  • People attending a session of parliament stand up to celebrate after lawmakers voted to legalize same sex marriage in Montevideo, Uruguay,Wednesday, April 10, 2013. The law was backed by 71 of the senators in the 92-seat legislature in Wednesday's vote. (AP Photo/Matilde Campodonico)

  • People celebrate after lawmakers voted to legalize same sex marriage inside Parliament in Montevideo, Uruguay, Wednesday, April 10, 2013. Supporters of the law, who had filled the public seats in the Senate, erupted in celebration when the results were announced. The bill received the backing of 71 members of the 92-seat chamber. (AP Photo/Matilde Campodonico)

  • A man holds up a gay pride flag as he and others celebrate after lawmakers legalized same sex marriage inside Parliament in Montevideo, Uruguay, Wednesday, April 10, 2013. The vote makes Uruguay the third country in the Americas after Canada and Argentina to eliminate laws making marriage, adoption and other family rights exclusive to heterosexuals. In all, 11 other nations around the world have already taken this step. (AP Photo/Matilde Campodonico)

  • People celebrate outside the Parliament after lawmakers passed the "marriage equality project" in Montevideo, Uruguay,Wednesday, April 10, 2013. Their vote makes Uruguay the third country in the Americas after Canada and Argentina to eliminate laws making marriage, adoption and other family rights exclusive to heterosexuals. In all, 11 other nations around the world have already taken this step. (AP Photo/Matilde Campodonico)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    people are gathered on Denfert-Rochereau square in Paris at the beginning of the demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. At left, foreground, a banner of a student union which reads : 'Students mobilised'. AFP PHOTO /THOMAS SAMSON (Photo credit should read THOMAS SAMSON/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    Girls take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO /THOMAS SAMSON (Photo credit should read THOMAS SAMSON/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    Tow men hold a French national flag and a rainbow flag as they gather to take the start of a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / KENZO TRIBOUILLARD (Photo credit should read KENZO TRIBOUILLARD/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO /THOMAS SAMSON (Photo credit should read THOMAS SAMSON/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / KENZO TRIBOUILLARD (Photo credit should read KENZO TRIBOUILLARD/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. Placard reads : 'Wedding for everybody' AFP PHOTO / KENZO TRIBOUILLARD (Photo credit should read KENZO TRIBOUILLARD/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / THOMAS SAMSON (Photo credit should read THOMAS SAMSON/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / THOMAS SAMSON (Photo credit should read THOMAS SAMSON/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / THOMAS SAMSON (Photo credit should read THOMAS SAMSON/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO /THOMAS SAMSON (Photo credit should read THOMAS SAMSON/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    A woman holds a placard reading 'Jesus had two fathers and one surrogate mother' during a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / KENZO TRIBOUILLARD (Photo credit should read KENZO TRIBOUILLARD/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People hold a giant rainbow flag as they take in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / KENZO TRIBOUILLARD (Photo credit should read KENZO TRIBOUILLARD/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / KENZO TRIBOUILLARD (Photo credit should read KENZO TRIBOUILLARD/AFP/Getty Images)

  • FRANCE-SOCIETY-WEDDING-DEMONSTRATION-PARIS

    People take part in a demonstration for the legalisation of gay marriage and LGBT (lesbian, gay, bisexual, and transgender) parenting, in Paris on January 27, 2013, two days before a parliamentary debate on the government’s controversial marriage equality bill, which will allow gay couples the same rights as their straight counterparts. AFP PHOTO / KENZO TRIBOUILLARD (Photo credit should read KENZO TRIBOUILLARD/AFP/Getty Images)