A judge in Trinidad and Tobago this week officially struck down a law that criminalized consensual sex between two people of the same gender.

In April, High Court Judge Devindra Rampersad ruled that Sections 13 and 16 of the Sexual Offences Act criminalizing consensual adult same-sex activity were unconstitutional.

“The court declares that sections 13 and 16 of the [Sexual Offences Act] are unconstitutional, illegal, null, void, invalid and of no effect to the extent that these laws criminalise any acts constituting consensual sexual conduct between adults,” Rampersad wrote.

The Sexual Offences Act, a holdover from British colonial rule, prohibits “buggery” and “serious indecency” between two men in the Caribbean nation. Violators face up to 25 years in prison.

In a 14-page ruling released this week, Rampersad said that it was unnecessary to “strike out” the laws. He said that the they should be modified to allow consensual gay sex.

The government has indicated that it will appeal the ruling.

In 2017, Jason Jones, an LGBT activist who lives in Britain but was born in Trinidad and Tobago, challenged the law.

(Related: India's highest court strikes down law that criminalized gay sex.)