(CNN) A young rape survivor who'd been accused of inducing an abortion and previously sentenced to 30 years in prison was acquitted of all charges by an El Salvador judge Monday at the conclusion of a retrial.

Evelyn Hernández, 21, was found innocent after the judge said there was not enough evidence to convict her, according to Hernández's defense team.

Salvadorean rape victim Evelyn Hernandez (C) celebrates with her lawyers after being cleared of murder after giving birth to a stillborn baby at home in 2016, at Ciudad Delgado's court in San Salvador on August 19, 2019. El Salvador has an extremely strict abortion ban.

In April 2016, Hernández was found on the floor of her bathroom drenched in blood. She was taken to a local emergency room in her hometown of El Carmen, roughly 40 kilometers (about 25 miles) east of the capital by her mother and a neighbor.

Doctors who examined her saw signs of a delivery but no baby and reported her to the authorities. When local officials arrived at her home five hours later, they found the newborn dead in a septic tank.

In 2017, Hernández was convicted and sentenced to 30 years in prison for killing the child. Prosecutors at the time claimed she had induced an abortion and left the baby for dead.

She served 33 months of her initial 30-year sentence and was freed last February after her legal team presented an appeal before the Supreme Court and requested her retrial. At the end of the retrial on Friday in Ciudad Delgado, prosecutors asked the court to impose an even longer sentence of 40 years.

Hernández had always attested to her innocence, saying that she did not even know she was pregnant until the delivery. Speaking to reporters last month, she said, "Had I know I was pregnant, I would have awaited the baby with pride and joy."

Hernandez's case has drawn an international spotlight onto the country's abortion laws, some of the strictest in the world.

Terminations are illegal in El Salvador under any circumstance, including when the pregnancy poses a risk to the mother or in cases of rape.

Both Hernández and her defense team have said that her pregnancy was the result of a rape.

After the verdict was handed down on Monday, Hernández was greeted by a crowd of supporters who had rallied outside the Ciudad Delgado courthouse.

"Thank God, justice was served," Hernández told reporters following the ruling.

"I thank all of you who have supported me and thank everyone from around the world who has shown support."

"It was tough to be locked up, especially when I was innocent," Hernández added. "There are others who are still locked up and I hope they are freed soon."

Law "criminalizes" women

The verdict has been hailed as a landmark moment by women's rights groups across the globe.

Paula Avila Guillen, director of the Latin America Initiatives for the Women's Equality Center, declared the verdict a victory for Hernández and El Salvador's interpretation of its strict abortion laws. The New York-based group had provided legal support and assistance to Hernandez throughout the trial.

"It seems the judicial system is starting to understand that stillbirths are not crimes, they are obstetric emergencies," Guillen told CNN. "People in El Salvador now understand that the law, as it stands right now, criminalizes women in poverty."

In a statement, Amnesty International called Hernández's acquittal a victory for human rights and called on the government to end "the shameful and discriminatory practice of criminalizing women once and for all by immediately revoking the nation's draconian anti-abortion laws."

Depending on the charge, Salvadoran women who are suspected of having an abortion or an induced miscarriage can face serious charges including aggravated homicide, with sentences ranging from two to 50 years in prison, according to Amnesty International.

Most of the women who have faced criminal charges for abortions in El Salvador come from poor rural backgrounds, and many suffered miscarriages or had obstetric complications because they weren't able to get regular checkups due to lack of resources.

Elizabeth Deras, one of Hernández's lawyers, told CNN last week the defense team was feeling positive because prosecution witnesses presented evidence that suggested that the baby died from complications during the delivery, which might have cleared Hernandez of any responsibility.

"The doctor who performed the autopsy on the child said the cause of death was aspiration pneumonia and that meconium was discovered inside the baby's stomach," Deras told CNN.

Prosecutors had asked for the longer sentence during her retrial, even after evidence of a stillbirth was presented by their witnesses.

Guillen said she expects the prosecution to appeal Monday's sentence.