Cortez was taken into custody and accused of attempted murder even though the baby was found alive and well. She faced up to 20 years in prison, according to her lawyer Alejandra Romero. Abortion is illegal in El Salvador under all circumstances, without exception.

Cortez’s defense argued she fainted while giving birth and had no control of her actions. The prosecutor’s office requested charges be changed to abandonment and helplessness, punishable by one to three years in prison.

Her defense agreed to the lesser charges, but the court ruled to exonerate her of all charges.

“The judge has said that Imelda is a victim of repeated sexual violence and that also explains why she couldn’t have behaved differently at the time she gave birth,” her attorney, Bertha Deleon, told reporters.

Cortez grew up being abused

Cortez grew up in an impoverished family in rural Jiquilisco municipality, southern El Salvador. From the age of 12, she was sexually abused by her 70-year-old stepfather, according to the petition to free her. The petition had received over 63,000 signatures as of Monday night.

Paula Avila-Guillen, director of Latin America Initiatives for the Women’s Equality Center who has spoken with Cortez’s lawyer, told CNN that the young woman “didn’t understand that she had just given birth, so after she found herself bleeding she started screaming and was taken to the hospital.”

“Later they found the baby who was completely healthy,” said Avila-Guillen, adding that after Cortez was detained, the child was cared for by Cortez’s mother who was still living with the stepfather.

“What makes Imelda’s case even more outrageous is that she had been a victim of sexual violence by her stepfather since she was 12 years old until she was 18, however she’s been treated as a perpetrator and not a victim,” Avila-Guillen said.