British lawmakers voted in favour of controversial legislation allowing gay marriage on Tuesday despite fierce opposition from members of Prime Minister David Cameron's own party.

The move puts Britain on track to join the ten countries that allow same-sex couples to marry, but Cameron had the embarrassment of seeing more than half of his Conservative legislators refusing to back him.

The prime minister insisted that the plan to allow same-sex couples to marry in England and Wales would "make our society stronger" although the draft law still has several other parliamentary hurdles to clear.

"Strong views exist on both sides but I believe MPs voting for gay people being able to marry too, is a step forward for our country," Cameron wrote on his Twitter page after the vote.

Deputy Prime Minister Nick Clegg, who leads the Conservatives' junior coalition partners, the Liberal Democrats, called the result a "landmark for equality".

"Tonight's vote shows parliament is very strongly in favour of equal marriage," he said. "Marriage is about love and commitment, and it should no longer be denied to people just because they are gay."

The vote passed by 400 to 175, mainly because it had overwhelming support from the Lib Dems and opposition Labour Party.

Just 127 of Cameron's 303 Conservatives voted in favour of the plans, with 136 voting against and 40 more either formally abstaining or not voting.

Two Conservative cabinet ministers, Owen Patterson and David Jones, were among those who voted against, while Defence Secretary Philip Hammond and Attorney General Dominic Grieve stayed away.

Cameron had allowed lawmakers a free vote on the issue, meaning they were not directed by party managers.

Opponents attacked the bill during an often impassioned day-long debate ahead of the vote in the House of Commons, or lower house of parliament.

Pleas from Cameron's heavyweight cabinet allies to persuade their Conservative colleagues to back his plans and avoid damaging divisions fell on deaf ears.

A former junior defence minister, Gerald Howarth, said the government had no mandate for such a "massive social and cultural change".

"I believe this bill is wrong, the consultation was a complete sham. It has caused deep and needless divisions within the Conservative Party," he said.

Another Conservative opponent, Roger Gale, said the legislation was "Orwellian".

"Marriage is the union between a man and a woman, has been historically, remains so. It is Alice in Wonderland territory, Orwellian almost, for any government of any political persuasion to seek to come along and try to re-write the lexicon," he said.

Same-sex couples in Britain have had the right to live in civil partnerships since 2005 but cannot marry.

Culture Secretary Maria Miller, the minister responsible for the legislation, insisted the bill would protect religious freedoms and "not marginalise those who believe marriage should be between a man and a woman".

The push to win over those Conservatives still bitterly opposed to gay marriage was led by three senior party members -- finance minister George Osborne, foreign minister William Hague and interior minister Theresa May.

In a letter to the Daily Telegraph, they said "attitudes to gay people have changed" and same-sex marriage was "the right thing to do at the right time".

The proposals are opposed by the Church of England and its new Archbishop of Canterbury Justin Welby, but the legislation bans the "official" churches from offering gay marriage.

The bill must next be scrutinised by a committee of lawmakers and then go before the upper chamber the House of Lords before becoming law.

While a majority of people in Britain back gay marriage, polls show that Cameron's strong support for the issue could undermine his party's chances at the next general election in 2015.

The issue has not however sparked the impassioned protests seen in France, where the National Assembly on Saturday overwhelmingly approved a key piece of legislation that will allow homosexual couples to marry and adopt children.