London (CNN) -- A bill to allow same-sex marriage in England and Wales passed the British House of Commons on Tuesday, clearing the way for it to go before Queen Elizabeth II for royal approval before the end of the week.
With the queen's approval -- a formality in the UK -- the first same-sex wedding could be held as early as next summer.
The Marriage Bill, as it was known, had the support of Prime Minister David Cameron, but his commitment has put him at odds with many in his Conservative Party and its grass-roots supporters. The Conservatives govern in coalition with the Liberal Democrats.
"The title of this bill might be marriage but its fabric is about freedom and respect," Culture Secretary Maria Miller said shortly after the bill's passage.
She said the passage of the bill was "clear affirmation that as a nation respect for each and every person is paramount regardless of age, religion, gender, ethnicity or sexuality."
Opposition Labour Party lawmakers helped the Marriage (Same Sex Couples) Bill stay on track when Conservative rebels backed an amendment that might have derailed it at an earlier stage in the Commons.
On Monday, Lord Alli said he was proud as a gay man serving in the House of Lords to have seen it pass the bill.
"My life and the lives of many others will be better today than they were yesterday," he said.
But an opponent of the bill, Lord Framlingham, said that while the legislation would make many people very happy, the House of Lords should "give some consideration to a much larger number of people, running into millions, whose lives will be less happy and whose concerns and problems will be increased by this legislation."
He said the House of Lords had been used to "to bulldoze through an ill-thought-through bill, the ramifications of which the people have not begun to understand."
Coalition for Marriage, an umbrella group of UK people and organizations that support traditional marriage between a man and a woman, has collected more than 650,000 signatures on a petition opposing any attempt to redefine it.
The Church of England is among the religious bodies opposed to the new legislation.
Stonewall, a gay rights campaign group, welcomed the bill's passage through the Lords on Monday.
"It's impossible to express how much joy this historic step will bring to tens of thousands of gay people and their families and friends," Chief Executive Ben Summerskill said in an online statement.
"The bill's progress through Parliament shows that, at last, the majority of politicians in both Houses understand the public's support for equality, though it's also reminded us that gay people still have powerful opponents."
He said Stonewall would now redouble its efforts in Scotland "so that every single gay person in Britain will soon enjoy full equality."
A law recognizing civil partnerships in England and Wales was passed in 2004.
The issue of same-sex marriage has also divided other nations.
A law that allows same-sex couples to marry and adopt was passed by France this year, despite large street protests and vocal opposition from religious groups. The move made it the ninth country in Europe to allow same-sex marriage.
In the United States, two landmark rulings by the Supreme Court last month gave the gay and lesbian rights movement huge political and legal momentum.
The justices said legally married same-sex couples will now enjoy the same federal benefits as heterosexual couples, striking down a key provision in the Defense of Marriage Act.
And although not granting a sweeping right of gays and lesbians to marry nationwide, a separate high court ruling effectively allows same-sex marriage to resume in California, the nation's most populous state.