SAN JOSE (Reuters) - A debate over gay marriage has upturned Costa Rica’s presidential race, giving ammunition to conservative frontrunners ahead of Sunday’s vote and challenging the Central American country’s image as a progressive bastion.

FILE PHOTO: Costa Rica presidential candidates (R-L) Antonio Alvarez Desanti, Rodolfo Piza, Carlos Alvarado, Fabricio Alvarado, and Juan Diego Castro, are seen before the debate for the Costa Rica 2018 presidential election in San Jose, Costa Rica, January 30, 2018. REUTERS/Juan Carlos Ulate

Evangelical Christian singer and congressman Fabricio Alvarado, who leads recent polls, has pitted himself against a January ruling from the Inter-American Court of Human Rights that urges Costa Rica to legalize same-sex marriage.

Alvarado, 43, has said the Costa Rica-based court is violating the country’s sovereignty and jeopardizing its “traditional family” values. He has threatened to withdraw Costa Rica from the court system, as Venezuela did.

“We are not ready for a LGBT agenda,” Alvarado said at a candidate debate. “Let’s make February 4 our referendum on the marriage between men and women.”

His meteoric rise is unlikely to be enough for him to win without a run-off vote in April. But Alvarado has pushed other candidates among the 13 contenders to adopt more conservative tones, including ex-government minister Antonio Alvarez Desanti, leader of the powerful National Liberation party.

Alvarez Desanti, a 59-year-old banana entrepreneur, has pledged to respect the court’s decision on gay marriage but said he would not personally support it. That sparked criticism from liberal factions of his center-right party in a country whose “pura vida,” catchphrase suggests a chilled approach to life.

Neither Alvarado nor Alvarez Desanti is expected to reach the 40 percent of votes required to win in the first round.

Conservative Juan Diego Castro also hopes to land on the April run-off ballot. The former justice minister is running on a platform of tough anti-crime measures and less restrictions on miners and oil companies in a nation known for stewardship of rainforests and oceans.

“FEAR OF GOD”

Out of three candidates who support same-sex marriage, the most likely to reach a second round is Carlos Alvarado, a former labor minister and an ally of President Luis Guillermo Solis.

Solis is barred by law from seeking a second consecutive term.

Despite Costa Rica’s reputation as socially forward looking, with high education and health standards, reproductive rights such as in vitro fertilization (IVF) and abortion are not widely accepted, and seven out of ten people consider themselves conservative, according to a University of Costa Rica poll.

“Those who propose gay marriage do not understand Costa Rica,” said Marcela Linares, 56, as she attended to her stall in a San Jose marketplace presided over by an image of Costa Rica’s patron saint. “This country is not that, here it is marriage between a man and a woman. Here there is fear of God.”

The gay community has counted some triumphs, however.

Solis’ administration and his Citizen Action Party (PAC) flew a rainbow-striped flag over the presidential house in 2014, the first time a Latin American government raised the gay rights banner over an official building.

A request from Solis several years ago prompted the Inter-American Court’s ruling on legalizing gay marriage.

“There is a hypocritical and electoral use of the resolution of the Inter-American Court. But it works in our favor - those who don’t believe in equality will be divided,” said Marco Castillo, an attorney and leader of the Diversity Movement advocacy group.

Many of Costa Rica’s 3.3 million voters are still unsure who to support, according to polls, after a campaign season marked by skepticism and apathy.

“I’m going to go vote, but I don’t yet know for who,” said José Esteban Ramírez, a 35-year-old dentist. “Before, I chose the least-worst, but now it is difficult to know who is the worst.”