Germany's president has signed legislation legalizing gay marriage, his office said Friday, paving the way for the bill to take effect this fall.

Lawmakers approved the bill on June 30 in parliament's last session before Germany's September election. The move became possible after Chancellor Angela Merkel, whose conservative party had long been reluctant to budge on the issue, said she would allow its lawmakers to vote according to their conscience.

The presidential office said President Frank-Walter Steinmeier signed the legislation on Thursday. That means it will come into force Oct. 1 at the earliest.

Germany has allowed same-sex couples to enter civil partnerships since 2001, but until now has not granted them full marital rights including the possibility of jointly adopting children. The change brings it into line with many other western European countries.

"Marriage is a question of love and responsibility and not of gender," Katarina Barley, the minister for families, said.

Barley, whose center-left party pushed for legalizing same-sex marriage, said that "marriage for everyone makes Germany a more modern country."