BOGOTA (Thomson Reuters Foundation) - Costa Rica’s top court has ruled that a ban on same-sex marriage is unconstitutional, a decision seen as a win for gay rights activists and welcomed by the country’s new president.

The Supreme Court gave lawmakers up to 18 months to legalize gay marriage, which has long been opposed by the Roman Catholic Church and evangelical groups in the Central American nation.

President Carlos Alvarado, who came to power earlier this year on a pro-gay rights platform, has publicly advocated same-sex marriage and vowed to implement the ruling.

“Our commitment to full equality remains intact,” he tweeted on Thursday. “We will continue to boost actions that guarantee no person will face discrimination for their sexual orientation or gender identity.”

The decision follows a judgment issued in January by the Inter-American Court of Human Rights (IACHR), the top rights body of the Americas based in Costa Rica.

It said its signatory member countries, including Costa Rica, must grant equal rights to same-sex couples, including the right to marry.

“We know it’s going to be an 18-month struggle but the battle is already won,” Marco Castillo, a lawyer and head of the LBGT rights group Diversity Movement, told the Thomson Reuters Foundation.

“It’s going to end with an equal marriage in Costa Rica.”

The change is likely to face stiff opposition from conservative and evangelical lawmakers in Costa Rica.

But Supreme Court judge Fernando Castillo told reporters after the ruling that the ban on gay marriage would automatically cease to exist if parliament failed to change the law by the deadline.

Many countries in mainly Catholic Latin America and the Caribbean ban same-sex marriage, but that is slowly changing.

Argentina, Colombia and Uruguay have all dropped their opposition in recent years.

“(To) those who are against this, we say live and let live,” said Castillo. “Many oppose for religious reasons, but the Bible says love your neighbor.”