A Salvadoran court on Monday acquitted a woman accused of homicide after giving birth to a stillborn baby in a case that drew international attention to the socially conservative nation's strict abortion ban.

Evelyn Hernandez, 21, was previously convicted of intentionally inducing an abortion and had already served three years of a 30-year prison sentence.

"Thank God, justice was done," Hernandez, in tears, told a cheering crowd outside the courthouse. "There are many women who are still locked up and I call for them to be freed soon, too."

In February, the Supreme Court ordered Hernandez released and retried, saying that the original judge's decision was based on prejudice and insufficient evidence.

Hernandez was raped by a gang member and said she was unaware of her pregnancy until just shortly before she gave birth to a stillborn son in April 2016.

"This is a resounding victory for the rights of women in El Salvador," Erika Guevara-Rosas, Amnesty International's Americas director, said about the verdict.

Some 147 Salvadoran women have been sentenced to up to 40 years in prison in such cases between 2000 and 2014, according to the Citizen Group for the Decriminalization of Abortion, a local rights group.

The group said it will seek fresh reviews of at least 16 similar cases.

Women prosecuted under El Salvador's hard-line abortion laws include those who have suffered stillbirths after home deliveries as well as abortions induced because of medical emergencies.

Hernandez's case attracted international attention and came nearly three months after President Nayib Bukele took office pledging a softer approach to abortion in a country that bans any intentional termination of a pregnancy.

At a university forum during the campaign, Bukele said he favored legal abortion in cases where the life of the mother is at risk, a position that represented a significant shift for the overwhelmingly Roman Catholic and evangelical country's abortion politics.

"We can't lose sight of the fact that there are many more women whose liberty has been unjustly taken from them. We're moving forward, and we want to keep fighting for the freedom of the others just like we were able to do for Evelyn," said Hernandez's lawyer, Bertha Deleon.

Amnesty International urged El Salvador "to end the shameful and discriminatory practice of criminalizing women once and for all by immediately revoking the nation's draconian anti-abortion laws."

Follow NBC Latino on Facebook, Twitter and Instagram.