Costa Ricans vote Sunday in a presidential race that has been turned on its ear by an international court ruling saying the country should let same-sex couples get married.

Evangelical candidate Fabricio Alvarado recently vaulted into first place in the polls after he took a strong stance against gay marriage, which about two-thirds of Costa Ricans also oppose.

His closest rivals are agri-businessman Antonio Alvarez of the opposition National Liberation Party and Carlos Alvarado of the governing Citizens' Action Party.

A recent survey showed that more than a third of likely voters were undecided. If no candidate gets 40 percent or more, the top two finishers advance to an April 1 runoff.

The January decision by the Inter-American Court of Human Rights has come to play a central role in the campaign. It also ordered the country to grant same-sex couples rights such the ability to inherit estates and adopt children.

Political analyst Francisco Barahona told The Associated Press that it came as an "external shock" for Costa Rica, a majority Roman Catholic nation.

Fabricio Alvarado, a 43-year-old journalist, preacher and Christian singer, called the ruling a "sovereign violation" and saw his support balloon in the polls as socially conservative voters gravitated to that message.

Carlos Alvarado — no relation — is the only major candidate to openly back gay marriage and has picked up some support recently from socially liberal voters. A 38-year-old also trained as a journalist, he got his start in politics as communications director for Citizens' Action and also was labor minister under current President Luis Guillermo Solis.

Alvarez, a two-time president of the Legislative Assembly and a Cabinet minister under the first presidency of Oscar Arias in 1986-1990, says he opposes gay marriage but backs recognizing certain other rights for gay couples.

Voters will also be selecting the 57 delegates that make up the Assembly.