BERLIN -- German lawmakers have voted to legalize same-sex marriage in a snap vote only days after Chancellor Angela Merkel changed her longstanding position.

Lawmakers voted 393 for legalizing "marriage for everybody" and 226 against with 4 abstentions.

Merkel herself voted against the measure, but paved the way for Friday's vote after saying Monday that lawmakers could take up the issue as a "question of conscience" -- freeing members of her conservative coalition, which has been against same-sex marriage, to individually vote for it.

Germany has allowed same-sex couples to enter civil partnerships since 2001, but same-sex marriages remained illegal until Friday's vote.

Get Breaking News Delivered to Your Inbox

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

Friday's session was the last planned for Germany's Bundestag, or parliament, until the election is held in September.

German Chancellor Angela Merkel and members of the lower house of parliament Bundestag vote on legalising same-sex marriage, in Berlin, Germany, June 30, 2017. REUTERS

Merkel sid she voted against same-sex marriage because she believes the country's law sees it as between a man and a woman, but that the opposite view must be respected.

"For me marriage as defined by the law is the marriage of a man and a woman," she said, adding that she continues to see the interpretation as a "decision of conscience."

The measure, which is expected to see legal challenges, also opens the door for gay couples to adopt -- which Merkel says she supports.

Merkel said on Monday that meeting a lesbian couple several years ago in her constituency, who have fostered eight children, helped to ease her opposition to same-sex marriage. The adoption of children by same-sex couples had been one of her concerns prior to meeting the family, Merkel said.

Germany has joined many other European nations where same-sex marriage is already legal, including Spain, Britain and France.