After Queen Elizabeth II gave her royal assent to a bill approved by lawmakers, paving the way for the first same sex weddings in 2014, Britain legalised gay marriage.
Members of parliament cheered as they were told the historic bill had passed into law, making Britain the 15th country worldwide to legalise gay marriage.
Prime Minister David Cameron pushed through the bill despite fierce opposition within his Conservative party.
"This is a historic moment that will resonate in many people's lives," said Culture Minister Maria Miller, whose department was responsible for the bill.
"I am proud that we have made it happen, and I look forward to the first same sex wedding by next summer."
The delay is because the government is sorting out issues such as the impact on pensions.
Government computer systems also need to be updated to allow same-sex marriages to be registered, at an estimated cost of Ģ2 million ($3 million, 2.3 million euros).
The bill legalises gay marriage in England and Wales. Scotland and Northern Ireland have their own laws on the matter.
Lawmakers in parliament's lower House of Commons first voted in favour of gay marriage in February despite fierce opposition from members of Cameron's Conservative party.
The upper House of Lords formally approved the bill on Monday, and it went back to the Commons for their final nod on Tuesday night after MPs agreed to changes such as ensuring protections for transgender couples.
The queen's assent, given in her capacity as head of state, was then announced in both chambers of parliament on Wednesday, at which point it became law.
The cheers that greeted the news belied the stormy passage that the bill had through parliament.
Dozens of Conservatives opposed it in the Commons while an attempt in the Lords last month to kill off the legislation with a "wrecking amendment" failed.
The debate took a surreal turn when Tory peer Norman Tebbit claimed the bill could result in a lesbian queen giving birth to an heir by artificial insemination.
Civil partnerships for gay couples have been legal in Britain since 2005, giving them identical rights and responsibilities to straight couples in a civil marriage.
But campaigners point to differences, such as gay couples' inability to choose a religious ceremony -- and their inability to call their partnership a "marriage".
The new law bans the established Churches of England and Wales -- which are opposed to gay marriage -- from conducting ceremonies.
Other religious institutions will be able to "opt in" if they wish.
The Catholic Church in England and Wales said it opposed the new law.
"The new act breaks the existing legal links between the institution of marriage and sexual complementarity," the Catholic Bishops Conference of England and Wales said in a statement.
"With this new legislation, marriage has now become an institution in which openness to children, and with it the responsibility on fathers and mothers to remain together to care for children born into their family unit, are no longer central. That is why we were opposed to this legislation on principle."
A poll by YouGov/Centre Ground showed that 54 percent of Britons supported the legalisation of gay marriage while 36 percent were opposed. The poll was carried out on July 2 and 3 with a sample of 1,923 people.
France became the 14th country to pass laws approving same-sex marriage in May, joining The Netherlands, Spain, Canada, South Africa, Norway, Sweden, Portugal, Iceland, Argentina, Denmark, Uruguay, Belgium, and New Zealand.
Gay couples can marry in 13 US states, as well as in the capital Washington DC, while parts of Mexico also allow same-sex marriage and a legal ruling allows it in Brazil.