Lawmakers in the Central American country accidentally passed a measure on Tuesday that would legalize same-sex unions when it was attached to larger bill.

A lawmaker from the capital city of San José, José María Villalta, inserted the language into the a reform of the Young People's Law, which covers various social services for young people and laws on marriage. Unaware of the measure, conservative lawmakers passed the measure without recognizing that the language could be interrupted to change the definition of civil unions to include same sex couples.

“During the discussion in the first debate, we explained that the Law of Young People should be interpreted with this sense of opening to gays and no one objected,” Villalta said, according to Costa Rica’s English-language newspaper, The Tico Times.

Some conservative lawmakers, however, balked at their legislative lapse, claiming that homosexuality is immoral and asking Costa Rican President Laura Chinchilla to veto the bill.

“That preference is not a right,” said Justo Orozco, a member of the evangelical National Renovation Party. “It’s a stunted development of sexual identity. It can change like alcoholism, tobacco addiction.”

Chinchilla has said that she does not oppose gay marriage, but has not openly campaigned for the passage of pro-same sex union legislation.

While the Central American country is known as one of the politically stable nations in the region, it doesn't lean as liberal as other Latin American nations in terms of gay rights. A recent study found that 73 percent of Costa Ricans opposed same-sex marriage.

While gay rights activists in Costa Rica were pleased – if not a little shocked – by the passage of the measure, they admitted that it still needs to survive a constitutional challenge in court.

“It is a big step forward for gay rights in Costa Rica,” said Marco Castillo, president of the Diversity Movement.

There are currently five countries in Latin America with support for same-sex union or marriage laws in place. Argentina and Uruguay both permit gay couples to marry, while Brazil, Colombia, and Ecuador recognize same-sex unions, The Washington Post reported.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino