SAN JOSE, Costa Rica -- Costa Ricans voted Sunday in a presidential race shaken 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 opinion polls after he took a strong stance against gay marriage, which about two-thirds of Costa Ricans also oppose.

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

But the outlook was cloudy because none of 13 candidates polled at more than 17 percent and surveys indicated that more than a third of likely voters were undecided.

If no candidate reaches 40 percent of the total vote, the top two finishers advance to an April 1 runoff.

"I see this as very divided," said Paula Rodriguez, a psychologist who cast her vote in Moravia, on the northeastern outskirts of the capital, San Jose. "I really think nobody knows what will happen."

The January decision by the Inter-American Court of Human Rights came to play a central role in the campaign. The court also ordered the country to grant same-sex couples such rights as 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 with an increasing evangelical population.

Alvarado, a 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 stance.

"Our message has already won. We are very happy and we hope we have convinced more undecideds," Alvarado told local media.

Carlos Alvarado, who is not related to Fabricio Alvarado, was the only major candidate to openly back gay marriage and picked up some support recently from socially liberal voters. 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, said he opposes gay marriage but backs recognizing certain other rights for gay couples.

Voters were also selecting the 57 delegates that make up the Assembly.