When Maria Teresa Rivera regained consciousness in an El Salvador hospital after suffering a miscarriage at home, she was handcuffed and hauled off to jail.

Accused of aggravated homicide in the death of her fetus, she was sentenced to 40 years in prison, where she became a symbol of the country’s draconian anti-abortion laws and the innocent women they ensnare.

“They took me to the hospital on the 24th [of November 2011] and on the 25th they sent me to jail,” the garment factory worker said, noting that she was still hemorrhaging when they locked her away.

In May, a judge annulled her conviction in a ruling activists call a much-needed victory in a country notorious for jailing women suspected of having abortions. Rivera was freed late last month after nearly five years in prison.

“I think Maria Teresa’s case proves that if the women still in prison [for obstetric emergencies] and the others who are being charged all the time receive adequate defense and attention, all of them would be free,” said Paula Ávila-Guillén, an attorney and programs specialist at the Center for Reproductive Rights who was involved in Rivera’s case.

El Salvador has among the strictest abortion laws in the world. A change to the country’s penal code in the 1990s criminalized abortion under all circumstances, including when a mother’s life or health is in danger and even in cases of rape. The country has also been one of the most aggressive in terms of prosecuting and imprisoning women believed to have taken matters into their own hands.

At least 129 women—some of whom suffered stillbirths or miscarriages, like Rivera—were prosecuted for abortion-related crimes between January 2000 and April 2011, according to La Agrupacion Ciudadana, a reproductive rights organization in El Salvador.

The organization played a crucial role in appealing Rivera’s sentence, which was dropped May 20 after a judge ruled that there was not sufficient evidence to prove that Rivera intentionally provoked her miscarriage.

“The judge agreed with what everybody else was saying: that there was no crime committed,” said Kathy Bougher, an activist working with La Agrupacion. “What happened was very sad and very tragic, but it wasn’t a crime, it was a natural occurrence.”

Rivera, who was photographed collapsing into her attorney’s arms after the verdict was read, later said in a message to supporters that she would continue to fight for her “compañeras” similarly suffering unjustly behind bars.

At least 25 other women remain in prison in El Salvador for obstetric emergencies, according to La Agrupacion. They are overwhelmingly poor—factory workers, domestic help, day laborers—and lack access to adequate legal help when the police arrive, often at their hospital beds while they are still under the effects of anesthesia.

They include Veronica, an illiterate domestic worker sentenced to 30 years in prison after her bosses accused her of aborting a fetus conceived as the result of rape. Another inmate, Alba, is an impoverished mother of two who was jailed after reporting the death of her third-born, who stopped breathing shortly after a premature home delivery. And women like Johana, another mother accused of homicide after suffering a fall that sent her into premature labor and resulted in the loss of her child.

“The cases all share very similar fact patterns. The majority of the women live in rural areas, have very low incomes and are single and all of them receive poor to almost no legal representation from the moment that they are sent to prison from the hospital,” Ávila-Guillén said, noting that hospital staff routinely break patient confidentiality rules to report suspected abortions to police.

Once behind bars, the women face dismal, overcrowded conditions, and red tape that often prevents them from keeping in touch with their families.

“Maria Teresa was always the strongest one,” said Ávila-Guillén. “She had a son outside of the prison waiting for her and that was something that gave her strength to keep on fighting. But unfortunately the last time we saw her in February, she was very sick… Because of the difficulty of the situation, even the strongest women just deteriorate.”

For women who do seek to terminate unwanted pregnancies in El Salvador, options are illegal and unsafe. According to Amnesty International, at least 11 percent of abortions in El Salvador result in maternal death.

The death rate for women in the U.S. obtaining legal abortions, meanwhile, is less than 1 per 100,000 procedures, according to the Guttmacher Institute.

“The one step [authorities] could take that will certainly reduce mortality—ensuring access to safe and legal abortion—is not being taken,” Amnesty International says.

The topic is not even openly discussed, partly because of cultural and religious norms that treat abortion as taboo, and partly out of fear of prosecution.

“Even talking about how you go about finding an abortion risks people going to jail,” said Bougher, who added that there is widespread confusion over the law.

But there are encouraging signs of reform.

Bougher says the country’s health minister has made efforts to increase access to birth control, which is legal but not always available to poor women. There was also a government report released late last year that addressed the topic of misogyny in judicial decisions.

And now, La Agrupacion is celebrating Rivera’s release from prison. “Obviously,” Bougher said, “everyone is ecstatic.”