Same-sex couples will be able to get married in England and Wales after new measures became law.
The government's controversial legislation on the issue received Royal Assent on Wednesday.
The Conservative, Labour and Liberal Democrat leaderships all backed the proposals, which were finally approved by MPs and peers earlier this week.
It is expected that the first gay and lesbian wedding ceremonies will take place by summer next year.
Under the terms of the Marriage (Same Sex Couples) Bill, religious organisations will have to "opt in" to offering weddings, with the Church of England and Church in Wales being banned in law from doing so.
Commons Speaker John Bercow announced the bill had received Royal Assent - the formal approval of the sovereign required for all legislation. The news was greeted with cheers in the Commons chamber.
MPs decided not to oppose a number of minor changes agreed by the House of Lords and approved the legislation on Tuesday.
There will also be a review of whether groups such as the humanists will be allowed to carry out marriages, while ministers said they were prepared to look at eliminating any difference in the treatment of gay couples when it came to pension schemes.
During the Commons debate, Equalities Minister Maria Miller said the passing of the bill was "clear affirmation" that "respect for each and every person is paramount, regardless of age, religion, gender, ethnicity or sexuality", she added.
But Conservative MP Sir Gerald Howarth, one of the bill's opponents, said it was "astonishing that a bill for which there is absolutely no mandate, against which a majority of Conservatives voted, has been bulldozed through both Houses".
He added: "I think the government should think very carefully in future if they want the support of these benches. Offending large swathes of the Conservative Party is not a good way of going about it."
But Paul Parker, recording clerk for Quakers in Britain, said: "It's wonderful to see same-sex marriage achieve legal recognition. Quakers see the light of God in everyone so we respect the inherent worth of each individual and each loving relationship."