A 21-year-old woman who gave birth to a baby in a toilet in El Salvador has returned to court for a second trial for murder in a case that has drawn international attention because of the country’s highly restrictive abortion laws.

Evelyn Beatriz Hernández, who says she was raped and had no idea she was pregnant, had already served 33 months of her 30-year sentence when the supreme court overturned the ruling against her in February and ordered a fresh trial with a new judge.

It is the first retrial of an abortion case in a country that aggressively pursues murder cases against women who have experienced miscarriages and obstetric emergencies.

Speaking as she entered the courthouse on Monday, Hernández said: “I want justice to be done. I know everything is going to be OK. My faith lies with God and my lawyers.” She added that she hoped for “good things, unlike what happened before, and I am innocent”. Hernández pleaded not guilty.

Women’s rights advocates hope the government of Nayib Bukele, who took office last month, will soften the country’s stance on reproductive rights. Dozens of women have been convicted of similar offences and jailed.

The woman’s lawyer, Elizabeth Deras, said: “What Evelyn is living is the nightmare of many women in El Salvador.”

Hernández has said she recalled making her way to an outhouse in a poor, rural community in April 2016 with strong abdominal pains. She squatted to defecate and the baby must have slid to the bottom of the septic tank, she says. Evelyn’s mother says she found her daughter passed out next to the makeshift toilet and hailed a pickup truck to transport her to a hospital 30 minutes away.

The foetus was 32 weeks old and forensic examiners were unable to determine at what point the death occurred. The cause remains unclear.

Both women insist they did not know there was a baby in the septic tank.

“I truly did not know I was pregnant,” Hernández said. “If I had known, I would have awaited it with pride and with joy.”

The supreme court has accepted the defence lawyers’ argument that no proof of Hernández having caused the baby’s death was presented.

The trial looks set to be the first test for reproductive rights under Bukele, who has said he believes abortion is only acceptable when the mother’s life is at risk, but added that he is “completely against” criminalising women who have miscarriages.

“If a poor woman has a miscarriage, she’s immediately suspected of having had an abortion,” he said last year. “We can’t assume guilt when what a woman needs is immediate assistance.”

Recent public opinion polls in El Salvador show broad support for more lenient abortion laws, such as allowing medical interventions when a mother’s life is in danger or the foetus is not viable. However, many Salvadorans still believe rape victims should be obligated to carry out their pregnancies.

The country is one of three in Central America with total bans on abortion, even in cases of rape and incest, or when the mother’s life is in danger.

Salvadoran law stipulates women who intentionally terminate a pregnancy, and doctors who assist them, should face up to eight years in prison. However, aggressive prosecutors frequently upgrade the charges to aggravated homicide, which carries a maximum 40-year sentence.

El Salvador is a deeply religious country, with 80% identifying as either Catholic or Evangelical Christian. Thousands of clandestine abortions are believed to be carried out each year.

The court adjourned the trial until 26 July.