MEXICO CITY – When Patricia Mendez miscarried in March 2015, she says police and detectives were called into the hospital ward to watch as she writhed in pain and expelled the dead, 20-week fetus.

"I was naked, with just the robe they give you, and I had all of them around as I miscarried," the 21-year-old recalled. "I was in a lot of pain, but nobody did anything. They just said, 'Confess, you have committed the worst sin in the world.'"

Eighteen of Mexico's 32 states have passed so-called right-to-life measures that have drawn criticism from women's rights activists, all in response to a 2008 law legalizing abortion in Mexico City. The legislation ranges from constitutional changes that outline general principles on protecting life from inception to a law in Veracruz state, where Mendez miscarried, that calls for unspecified "educational measures" for women who abort.

Mendez's lawyers are using her case to try to get the Veracruz law overturned, with the Supreme Court set to consider it Wednesday. If successful, they hope it could open a debate about whether abortion should be decriminalized across Mexico.

That would face opposition from pro-life sectors that support the state constitutional amendments on the grounds they protect the unborn.

"It is about the defense of something so valuable that we have, which is life. ... I ask for your prayers," Roman Catholic Archbishop Hipolito Reyes of the Veracruz city of Xalapa said in July.

The Veracruz state's governmental Institute for Women, which apparently is in charge of administering the re-education program, did not respond to repeated requests for comment.

Mendez, a 21-year-old university student, talked with The Associated Press in a recent interview in the central state of Guanajuato, where she fled to escape what she called persecution in Veracruz.

"They treated me worse than an animal. I felt like I could have died there and nobody would have done anything," she said of her treatment as she miscarried.

She was made to sign some papers and then, she said, a nurse held the fetus to her face and said: "Kiss him. You have killed him."

Then her ex-boyfriend's family held a funeral for the fetus, and she was forced to attend.

"I have never seen anything like that," said Veronica Cruz, a human rights lawyer who is representing Mendez. "They performed a whole funeral and they opened the casket to make her look at the fetus."

Mendez's experience is an extreme example of what activists say is harassment by some Mexican health workers, police and others who take matters into their own hands and try to impose their own punishment in such cases.

There is no way to be sure how often such treatment occurs. But activists say medical workers sometimes call police on patients who miscarry, regardless of the circumstances. State-appointed defense lawyers appear and accuse the clients they are supposed to be representing of having an abortion or even of murder. The stigma can last after the fact as women become pariahs in their communities, and some choose to move away.

Mendez was charged with having an abortion and could potentially be subjected to the "educational measures" provided for by the Veracruz law. Nobody really knows what the term means, since it is not defined and has yet to be enforced. So far Mendez's legal team has stalled the charges through appeals.

Backers of the Veracruz law present it as a gain for women because they would no longer go to prison if convicted of having an abortion.

But women's activists argue it sends a message that women who abort are social deviants who need correction. They say as long as the law is on the books, women are at the mercy of how judges might decide to apply it.

Another of Mendez's lawyers, Javier Angulo, argued that the law is unprecedented, has numerous irregularities and potentially subjects them to punishment with no time limit and thus theoretically could be applied for life.

"There is no other crime in all of Mexico's criminal codes that is punished with 'educational measures,'" Angulo said.

It's not clear whether the Supreme Court, which ruled in 2008 that states have the right to legislate their own criminal codes and has not struck down any of the right-to-life laws to date, will issue a decision Wednesday. It may simply either decline to hear the case or agree to do so and set a future date.

Rights activists say there are also cases where public servants have disregarded protections for women and girls in reproductive laws.

In 1999, a 13-year-old rape victim in Baja California state became a cause celebre after medical authorities refused to give her an abortion as allowed by law. She later gave birth to the child.

Paulina Ramirez's case was brought to the Inter-American Commission on Human Rights in 2002, drawing international attention and sparking a high-profile campaign seeking reparations.

The government later agreed to pay more than $33,000 to Ramirez, who has publicly identified herself as the victim in the case.

Earlier this year in the northern state of Sonora, a judge issued a ruling denying a 13-year-girl a legal abortion on the grounds that she was not a victim of rape but of statutory rape.