Five days after a Bermuda law repealing same-sex marriage on the British territory went into effect, a judge has struck it down as unconstitutional.

Bermuda Supreme Court Chief Justice Ian R. C. Kawaley on Wednesday struck down the law, known as the Domestic Partnership Act.

Gay and lesbian couples gained the right to marry in May, 2017 after a Supreme Court justice ruled in their favor.

Lawmakers responded by approving the Domestic Partnership Act, which recognizes the unions of gay couples with domestic partnerships. Governor John Rankin signed the law in February.

LGBT rights group OutBermuda challenged the law in court.

The Human Rights Campaign (HRC), America's largest LGBT rights advocate, praised the ruling.

“The Bermuda Supreme Court has righted the injustice that occurred when Bermudian lawmakers made the islands the first national territory in the world to repeal marriage equality,” HRC Global Director Ty Cobb said in a statement. “We congratulate the plaintiffs in this case on their historic victory ensuring that once again, love wins.”

Kawaley stayed implementation of his ruling for six weeks to allow the government time to file an appeal.