Britain legalised gay marriage Wednesday 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.

Members of parliament cheered as they were told the historic bill, pushed through by Prime Minister David Cameron despite opposition within his own party, had passed into law.

The first gay weddings are expected in the middle of next year as the government is sorting out issues such as the impact on pensions.

"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."

MPs in parliament's lower House of Commons formally approved the bill on Tuesday night, a day after the upper House of Lords gave it the nod.

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.

"I have to notify the House in accordance with the Royal Assent 1967 that Her Majesty has signified her Royal Assent to the following acts... Marriage (Same Sex Couples) Bill," John Bercow, the speaker of the House of Commons, told MPs.

The cheers that greeted the news belied the stormy passage that the bill had through parliament, during which many of Cameron's Conservative MPs opposed it.