A court in El Salvador has acquitted a woman of premeditated homicide after her baby died hours after a home birth.

The judge of the city of Ahuachapán has finally dropped the criminal case, said the Citizens' Association for the Decriminalization of Abortion (Acdatee) on Thursday.

The woman faces up to 30 years in prison if convicted.

Three years ago, the then 22-year-old gave birth to a little girl in the bathroom of her house.

Relatives took the young woman and her daughter to a hospital for emergency medical care.

There the newborn died.

The staff reported the case to the police, and the 22-year-old was arrested and charged with premeditated murder.

According to Acdatee, the case was "tentatively" dismissed two years ago because prosecutors could not produce any evidence to support their allegations.

The Attorney General's Office then appealed.

EL Salvador has had an extremely restrictive abortion law since 1998: it forbids any termination of pregnancy, even after rape or when the mother's life is in danger.

The criminal law provides for up to eight years imprisonment for abortions.

However, prosecutors and judges often classify cases in which children are stillborn or die shortly after birth as premeditated homicide, punishable by up to 50 years in prison.