The Constitutional Court examined a 2009 law following a complaint from two women who were refused permission to enter a formal marriage by authorities in Vienna.

It said in a ruling published on Tuesday that restrictions on same-sex marriage will be lifted at the end of 2018 unless the government does so itself earlier.

The Constitutional Court said that civil partnerships will remain an option after the law is changed, and will then be open to straight couples.

Civil partnerships have been legal in Austria since 2010.

Austria joins Germany, which recently legalized gay marriage, as well as Argentina, Belgium, Brazil, Canada, Colombia, Denmark, Finland, France, Iceland, Ireland, Luxembourg, Malta, Mexico, the Netherlands, New Zealand, Norway, Portugal, South Africa, Spain, Sweden, the U.K., the U.S., and Uruguay, all of which recognize same-sex marriage nationwide or in some parts. Australia may be next: During a debate on a bill legalizing gay marriage Monday, one Australian lawmaker proposed to his longtime partner.