Gay and lesbian couples can marry in Slovenia after a top court struck down the small European country's bans on same-sex couples getting married and adopting children.

In a 6-3 ruling handed down Friday, the nation's Constitutional Court said that Slovenia's marriage laws discriminate against gay couples, which is prohibited by the constitution.

The court gave lawmakers six months to update the nation's marriage law but said its ruling would go into effect immediately, The Washington Post reported.

Luka Mesec, the minister of labor, family, social affairs, and equal opportunities said that the required changes would be in place in a week or two.

Discrimination against same-sex couples “cannot be justified with the traditional meaning of marriage as a union between a man and a woman, nor with special protection of family,” the ruling states.

The plaintiffs in the case were two same-sex couples who wish to marry or adopt children.

Slovenia has recognized gay couples with civil partnerships since 2017. Partnerships provide gay couples with most of the rights of marriage except joint adoption.

In 2015, Slovenia's parliament approved a bill to legalize marriage equality. However, a majority of voters rejected the law in a referendum. Pope Francis called on Roman Catholics to vote against the law.