A regional Costa Rican court has recognised Central America’s first same-sex civil union, despite opposition from the Catholic Church and conservative politicians, local media reported on Wednesday.

The decision follows a same-sex couple’s two-year legal battle seeking the right to a state welfare credit, but it does not extend to other gay couples, whose cases will be decided individually, a lawyer said, as newspaper La Nacion reported.

Conservative lawmakers told La Nacion they were evaluating whether the decision contravenes family law, potentially leaving it open to appeal to a higher court.

“I didn’t think it was going to happen now since it was such a long process. It took us by surprise and it’s a great victory ... not just for us but for the whole country,” one of the couple, Cristian Zamora, was quoted as saying by the CRhoy news website.

The court’s decision angered Jose Francisco Ulloa, the bishop of the city of Cartago.

“I agree that people with this special inclination have rights like any citizen, but these are never equal to a normal, natural marriage, like we have in Costa Rica between a man and a woman,” he said.

Leftist president Luis Guillermo Solis’ attempts to legalise civil unions for all gay couples have been held up for months in the country’s legislative assembly by conservative political opponents.

Solis is an enthusiastic gay rights supporter and raised a gay pride flag at the presidential palace to mark the International Day Against Homophobia and Transphobia a month after his election in 2014.