Updated

Legislators have voted in Uruguay by a razor-thin margin to legalize abortion.

In Latin America, where the majority of people are Catholic, no country except Cuba has made abortions accessible to all women during the first trimester of pregnancy.

The vote in Uruguay's Chamber of Deputies was 50-49 just before midnight Tuesday after several lawmakers on each side of the debate said they could not in good conscience go along with their parties, and allowed substitutes to vote in their stead.

President Jose Mujica says he will allow it to become law, if the Senate approves the changes. The Senate already has approved an even more liberal version of the abortion measure.

The Chamber of Deputies' legislation would give women the right to a legal abortion during the first 12 weeks of pregnancy, and decriminalize later-term abortions when the mother's life is at risk or when the fetus is so deformed that it wouldn't survive after birth. In cases of rape, abortions would be legal during the first 14 weeks.

Deputy Pablo Abdala of the opposition National Party vowed Wednesday to promote a popular referendum to overturn the law, if Mujica doesn't veto it, calling the measure a violation of human rights.

However, polls suggest many more Uruguayans favor abortion rights than oppose them.

A survey this month showed 52 percent of Uruguayans would vote to legalize abortion if the question were put to the people, while 34 percent would vote against it. The survey of 802 people nationwide by the CIFRA consulting firm had a 3.4 percentage point margin of error.

Abortion rights advocates were disappointed by compromises made to secure the votes, including a requirement that women seeking abortions justify their request before a panel of at least three professionals -- a gynecologist, psychologist and social worker -- and listen to advice about alternatives including adoption and support services if she should decide to keep the baby. Then she must wait five more days "to reflect" on the consequences before the procedure.

Such bureaucratic barriers will only delay the procedures and force more women to seek illegal and dangerous abortions elsewhere, they said. Abortion rights advocates also were upset by a clause preventing any woman who hasn't lived in the country for at least a year from obtaining abortions in Uruguay.

"This is not the law for which we fought for more than 25 years," complained Marta Agunin, who directs Women and Health, a non-governmental organization in Uruguay.

Her group staged a colorful protest outside Congress during the debate and more than a dozen women posed in the nude in extremely cold weather, their bodies painted orange with purple flowers.

Deputy Alvaro Vega with the ruling Broad Front coalition said it would be better to simply eliminate criminal penalties for first-term abortions, and leave such decisions up to individual women alone. But in the end, every member of the lower house who supports abortion rights voted in favor of the measure.

The goal is to reduce the number of illegal abortions in Uruguay, said Deputy Ivan Posada of the small center-left Independent Party, who authored the measure and provided the key tie-breaking vote.

"They talk of 30,000 a year, a hypothetical number, but whatever the number is, it's quite dramatic for a country where 47,000 children are born each year," Posada explained in an Associated Press interview.

The review panel should obtain the father's point of view, but only if the woman agrees. Women under 18 must show parental consent, but they can seek approval from a judge instead if they're unwilling or unable to involve their parents in the decision.

The measure also allows entire private health care institutions, as well as individual health care providers, to decline to perform abortions.

Opponents include Uruguay's Catholic and evangelical institutions, which along with public hospitals provide much of the available health care in Uruguay.

Cuba, which decriminalizes abortions in the first 10 weeks of pregnancy, is the only country in Latin America where legal abortion is common. Argentina and Colombia allow it only in cases of rape or when the mother's life is endangered. Colombia also allows it when there is proof of fetal malformation. Mexico City has legalized first-trimester abortions, but there are restrictions in most other parts of the country.

Many countries ban abortions under any conditions.