A woman who was jailed for attempted murder under El Salvador's strict anti-abortion laws has been freed.
Imelda Cortez, 20, says she became pregnant by her stepfather who sexually abused her for many years.
Doctors suspected she had tried to perform an abortion after she gave birth to a baby girl in a latrine in April of last year.
The child survived, but Ms Cortez was arrested and spent more than 18 months in custody as she awaited trial.
Prosecutors argued that her failure to tell anyone about the pregnancy and seek medical help after giving birth amounted to attempted murder, which carries a possible 20-year sentence.
But on Monday a court ruled that Ms Cortez, who was unaware that she was pregnant, had not tried to kill her child.
Her lawyers said that to avoid a harsher sentence she had admitted to neglecting her newborn baby, an offence that carries a one-year jail term.
But the court ultimately decided that she was not guilty of any crime and was free to go home.
"This sentence… represents hope for women who are still in prison and are also being tried for aggravated homicide," defence lawyer Ana Martinez told reporters following the verdict.
Ms Cortez was greeted outside the court in Usulután by cheering relatives and human rights activists bearing signs with messages of support.
Prosecutors say her stepfather has been arrested and is awaiting trial.
El Salvador is one of a handful of countries in the world where abortions are completely banned and carry heavy sentences.
While the country is not alone in Latin America in having a total ban on abortions, it is particularly strict in the way it enforces it.
Doctors have to inform the authorities if they think a woman has tried to end her pregnancy. If they fail to report such cases, they too could face long sentences in jail.
The result is what human rights groups are calling a criminalisation of miscarriages and medical emergencies, with more than 100 people convicted of abortion-related crimes in El Salvador since 2000.