Updated

Uruguay's Senate voted to legalize first-trimester abortions for all women Wednesday in a groundbreaking measure that came with so many strings attached it left neither side in the bitter debate completely satisfied.

Senators voted 17-14 to back the measure, which has already passed the lower house, and President Jose Mujica was expected to quickly sign it into law.

The legislation establishes that the public health care system must guarantee every woman the freedom to decide without pressure whether or not to have an abortion.

That's a big step for Latin America, where only Cuba grants all women the right to abortions. But it comes with so many conditions that both sides wonder how Uruguay will keep this promise.

Among other things, a clear declaration that "every adult woman has the right to decide whether to end her pregnancy during the first 12 weeks of gestation" was dropped in order to get enough votes for passage. In its place, lawmakers agreed to 10 pages of fine print intended to bring about the same results.

It's not the best law, "and not the solution we wanted, but it's an advance," said Sen. Luis Gallo, a supporter and member of the ruling Broad Front coalition. Women who decide to get abortions can now avoid the "humiliating secrecy" of illegal abortions, he argued.

All the ruling Broad Front coalition's senators voted in favor, joined by one member of the opposition, Jorge Saravia of the center-right National Party.

The immediate reaction to the vote was muted since the result had been expected.

When Senate president Danilo Astori declared the measure's passage, a small group of abortion rights activists briefly applauded. There were no street protests, just a blast of fresh anti-abortion graffiti painted overnight on the sidewalks outside Parliament.

"It's a huge step," ruling coalition Sen. Rafael Michelini said, adding that women will now no longer have to ask the state for permission. "The woman who decides to have an abortion does it."

There are no firm estimates for how many women have obtained abortions illegally in Uruguay, but thousands were ending up in hospitals with complications each year until the government made morning-after pills widely available. Ruling party lawmakers said reducing dangers from illegal abortions was their primary motivation.

Opponents vowed to overturn the measure, either through a popular plebiscite or by defeating the Broad Front government in the next presidential elections.

"This project is an attack on life and that's why we have voted against it. If we win power in the 2014 elections, we'll seek to overturn it," National Party Sen. Jorge Larranaga told The Associated Press after the vote.

Mujica's wife, Sen. Lucia Topolansky, voted in favor and said she also favors the idea of a popular referendum on abortion. She expressed confidence that Uruguayans would approve it.

Recent polls have suggested that a majority of Uruguay's 3.3 million people favor decriminalizing abortion, as this law accomplishes.

"The vote was expected, but it's an extraordinarily important step," a governing party senator, Alberto Couriel, told the AP.

Mujica's predecessor and potential successor, fellow Broad Front leader Tabare Vazquez, vetoed a similar law, but the current president said he would sign whatever lawmakers approved.

Uruguay's measure decriminalizes abortions for women who follow the new rules, but also explicitly says that women who break the rules will not face jail time. However, anyone who helps women obtain abortions outside the margins of the new law would face up to two years in jail.

The law requires a woman seeking an abortion to first explain her situation to a review panel made up of a gynecologist, a mental health expert and a social worker. The woman must describe "how the pregnancy happened and any difficulties she faces in terms of finances, social and family situations, age or other issues that prevent her from wanting to continue the pregnancy."

The panel in turn must inform the woman about the reach of the law, risks of abortion, alternatives including adoption, and social and economic support that's available.

"The interdisciplinary panel must create an atmosphere of psychological and social support for the woman to enable her to overcome the causes that led her to want to abort the pregnancy and guarantee that she makes a conscious and responsible decision," the measure says.

Then, the woman must wait at least five days before confirming her decision.

The new law is "insufficient, but it marks a milestone in the long-term fight that has just begun. Now its implementation will have to be monitored, to make sure it's applied in all the hospitals," said Romina Napiloti, a 27-year-old sociologist and abortion rights activist who watched the vote from the Senate gallery.

Another compromise provides a conscience exemption so that health care professionals opposed to abortion can avoid participating. Institutions such as Uruguay's extensive Roman Catholic and evangelical hospital networks can opt out as well, but only if they make agreements with other institutions such as the public health care system so that any of their patients can get abortions elsewhere.

Dr. Maru Gonzalez, a gynecologist and bioethicist at the Universidad de la Republica, said she will do everything in her power to persuade other doctors in her field to boycott the review panels. But even then, she worries the law will fail to keep its goal of reducing the number of abortions overall.

"This law changes abortion from a crime into a right in the sense that it's being introduced into the public health system, and for those who support abortion, this is a gigantic advance," she said. "For me, it's a setback."

The measure also decriminalizes late-term abortions when a mother's life is at risk or the fetus won't survive. Rape victims would be able to get legal abortions through 14 weeks of pregnancy.

Judges would no longer be involved when adults seek the procedure, and while minors would need court approval, they need not get permission beforehand from their parents. The law says a woman's sex partner should be consulted, but only with her consent.

Maria Jose Del Campo, a 37-year-old engineer who was part of an anti-abortion group in the Senate gallery, said what's missing in Uruguay is government support for women so that they don't find themselves in situations where abortion seems the best alternative.

"The real problem is to provide support and alternatives to this woman who ended up pregnant," she said, citing long-stuck proposals in Congress to provide for more flexible workplace rules for pregnant women, such as job-sharing and government-paid maternity leave.