A clear majority of German MPs have voted to legalise same-sex marriage, days after Chancellor Angela Merkel dropped her opposition to a vote.
The reform gives gay men and lesbians full marital rights, and allows them to adopt children.
At present, same-sex couples are limited to civil unions.
Mrs Merkel’s political opponents were strongly in favour. But Mrs Merkel, who gave MPs the go-ahead for a free vote only on Monday, voted against.
The measure was backed by 393 lawmakers, while 226 voted against and four abstained.
The German legal code will now read: “Marriage is entered into for life by two people of different or the same sex”, AFP news agency reported.
How did Merkel prompt the vote?
During her 2013 election campaign, Mrs Merkel argued against gay marriage on the grounds of “children’s welfare,” and admitted that she had a “hard time” with the issue.
But at an event hosted by the women’s magazine “Brigitte” on 26 June, she shocked the German media by announcing on stage that she had noted other parties’ support for it, and would allow a free vote in the future.
The usually-cautious chancellor said she had had a “life-changing experience” in her home constituency, where she had dinner with a lesbian couple who cared for eight foster children together.
As the news spread on Twitter, supporters rallied under the hashtag #EheFuerAlle (MarriageForAll) – and started calling for a vote as soon as possible.
Following Friday’s vote, Mrs Merkel said that for her marriage was between a man and a woman. But she said she hoped the passing of the bill would lead to more “social peace”.
Does gay marriage have popular support?
Yes – a recent survey by the government’s anti-discrimination agency found that 83% of Germans were in favour of marriage equality.
The day after the Republic of Ireland voted to legalise gay marriage in May 2015, almost every German newspaper splashed a rainbow across its front page.
“It’s time, Mrs Merkel” Green party leader Katrin Goering-Eckhart said then. “The Merkel faction cannot just sit out the debate on marriage for everyone.”
Why is this happening now?
Because of an upcoming general election. Germans go to the polls on 24 September, and the sudden Merkel turnaround has deprived her opponents of a campaign issue.
Mrs Merkel’s current coalition partners – the centre-left Social Democrats (SPD) – had ruled out a future coalition deal unless reform was agreed on.
The Greens, the far-left Linke, and the pro-business Free Democrats took the same view.
The right-wing Alternative for Germany (AfD) is now the only party to oppose same-sex marriage.
But conservatives within Mrs Merkel’s own CDU were against a change – as was the CDU’s Bavarian sister party, the Christian Social Union (CSU), whose votes Mrs Merkel needs in the September election.
Commentators say this partly explains why she has rejected a vote on marriage equality until now.
How did Merkel’s opponents react?
Amid a groundswell of public support for a vote, Mrs Merkel’s rivals moved to capitalise politically.
A day after her comments, the SPD’s candidate for the chancellorship Martin Schulz declared – “we will take her at her word,” and called for an immediate vote.
The Greens and Linke promptly backed the prospect.
The CDU responded by condemning the SPD, its coalition partner, for its “breach of trust” after four years of joint rule.
The angry exchange came just days after Mr Schulz angered conservatives by accusing Mrs Merkel of an “attack on democracy”, saying she was deliberately making politics boring so that opposition supporters wouldn’t bother to vote.
Where else in Europe has same-sex marriage?
A host of European countries have beaten Germany to a same-sex marriage law.
Civil marriages are legally recognised in Norway, Sweden, Denmark (excluding the Faroe Islands), Finland, Iceland, the Netherlands, Belgium, Spain, Portugal, Luxembourg, France, the UK (except Northern Ireland and Jersey), and the Republic of Ireland.
But in Austria and Italy – as in Germany before Friday’s vote- gay couples are restricted to civil partnerships.