A court in El Salvador has freed a woman who was sentenced to 30 years in prison for aggravated homicide after her baby was found dead in the toilet where she gave birth to it before fainting.
Evelyn Beatríz Hernández Cruz, 20, had served nearly three years of her sentence.
Following an appeal a court ordered she be re-tried, but she will be able to live at home during the process.
She and her lawyers have always maintained she was unaware she was pregnant and no crime had occurred.
But prosecutors said she was guilty of murder because she had had not sought out antenatal care.
Activists greeted her at the jail gates, chanting "Evelyn, you are not alone".
The Central American country bans abortion in all circumstances, and dozens of women have been imprisoned for the deaths of their foetuses in cases where they said they had suffered miscarriages or stillbirths.
In April 2016, Ms Hernández gave birth in the latrine of her home in a small rural community. She lost consciousness after losing large amounts of blood.
Her mother told the BBC that police arrived at a hospital after the pair went there for emergency care.
Ms Hernández said she did not know whether her baby had been born alive or dead, and that she would have gone to see a doctor if she had known she was pregnant.
During her original trial she said she had been repeatedly raped. Her lawyers said she was too frightened to report the rapes, and some reports said the man who raped her was a gang member.
Medical experts could not determine whether the foetus had died in her womb or just after being born.
Although she was in the third trimester, Ms Hernández said she had confused the symptoms of pregnancy with stomach ache because she had experienced intermittent bleeding, which she thought was her menstrual period.
She told the court: "I did not want to kill my son."
The judge did not believe she did not know she was pregnant.
Much of the case centred on whether the baby was dead at birth or died in the moments afterwards, but medical experts were unable to determine the answer definitively.
Rights organisations in El Salvador says there are still at least twenty other women in jail under the country's strict abortion laws. In the last decade, campaigners have managed to free around 30 through evidence reviews and retrials.
Pro-choice campaigners in the Salvadoran group Agrupación Ciudadana welcomed Ms Hernández's release and said they hoped a new judge would consider that there was no scientific evidence to incriminate her.
Amnesty International has said El Salvador is "one of the most dangerous countries to be a woman".
Correction 23rd July 2019: This article was amended to reflect that it is not clear whether Ms Hernández's baby was dead at the time of birth.