BERLIN (AP) – German lawmakers voted Friday to legalise same-sex marriage after a short but emotional debate, bringing the country in line with many of its Western peers. Though Chancellor Angela Merkel voted against the measure, she paved the way for its passage by freeing other members of her party to vote their “conscience.”

Lawmakers voted 393 for legalising “marriage for everybody” and 226 against, with four abstentions.

Merkel said Monday that lawmakers could take up the issue as a “question of conscience,” allowing members of her conservative coalition, which has been against same-sex marriage, to individually vote for it.

German Chancellor Angela Merkel, center, gestures as a lawmaker raising a “No”-polling card during a meeting of the German Federal Parliament, Bundestag, at the Reichstag building on same-sex marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Michael Sohn)

While some in Merkel’s conservative bloc spoke against the measure, Berlin Christian Democrat Jan-Marco Luczak urged his fellow party members to vote for same-sex marriage.

“It would be absurd to try and protect marriage by preventing people to marry,” he told lawmakers.

Many applauded Merkel’s comments that opened the way for the vote, but Social Democrat lawmaker Johannes Kahrs noted in the debate that the chancellor had been a longtime opponent of gay marriage.

“Many thanks for nothing,” he said bluntly.

Germany has allowed same-sex couples to enter civil partnerships since 2001, but has not granted them full marital rights, which include the possibility to jointly adopt children.

The new law won’t take effect for several months because it still needs to pass the upper house of Parliament and be approved by the president, though those are formalities. It is also expected to face legal challenges.

Merkel told reporters after the vote that her vote against the measure was based upon her reading of the country’s law concerning marriage and that she did think gay couples should be able to adopt.

Germany’s basic law is vague, saying only that “marriage and the family shall enjoy the protection of the state,” but Merkel said that for her “marriage as defined by the law is the marriage of a man and a woman.”

She added, however, that she stood by her contention that the interpretation was a “question of conscience” and urged all views to be respected.

“It was a long, intensive, and for many also emotional discussion, that goes for me personally too, and I’m hopeful not only that there will be respect for either side’s opinions, but that it will also bring about more peace and cohesion in society,” she said.

All of Merkel’s potential coalition partners after the September election, including the center-left Social Democrats of her challenger, Martin Schulz, have been calling for same-sex marriage to be legalized.

It is not clear whether Merkel thought her Monday comments would prompt such a quick vote, but many analysts have suggested that by opening the door to gay marriage the chancellor removed yet another issue that might have helped her opponents in their campaigns against her.

In nearly 12 years as chancellor, Merkel has moved her party to the center and away from conservative orthodoxy, speeding up Germany’s exit from nuclear power and ending military conscription among other moves.

___

Frank Jordans contributed to this report.

German Chancellor Angela Merkel gives a press statement after German parliament Bundestag voted to legalise same-sex marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Markus Schreiber)

Parliamentarians queue to cast their votes after a debate of the German parliament Bundestag on the gay marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Markus Schreiber)

Members of the parliament cast their votes after a debate of the German parliament Bundestag on the gay marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Markus Schreiber)

Green Party’s gay rights activist Volker Beck, center, and fellow faction members celebrate with a confetti popper after German Federal Parliament, Bundestag, voted to legalize same-sex marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Michael Sohn)

German Chancellor Angela Merkel, left, talks to Baden-Wuerttemberg governor Winfried Kretschmann of the Green Party prior to a debate of the German parliament Bundestag on the gay marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Markus Schreiber)

German Chancellor Angela Merkel arrives for a debate of the German parliament Bundestag on the gay marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Markus Schreiber)

German Chancellor Angela Merkel, right, and German Foreign Minister Sigmar Gabriel attend a debate of the German parliament Bundestag on the gay marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Markus Schreiber)

German Chancellor Angela Merkel listens to a debate of the German parliament Bundestag on the gay marriage in Berlin, Germany, Friday, June 30, 2017. (AP Photo/Markus Schreiber)