SAN FRANCISCO (CBS SF/AP) — A superior court judge ordered the release of a central California woman to a drug treatment center while she awaits trial for the murder of her stillborn baby two years ago.

Chelsea Becker, 26, has been in a Kings County jail since her arrest in November 2019, unable to raise $2 million bail. Kings County Superior Court Judge Robert Shane Burns on Tuesday granted her attorneys’ request to release her to an out-of-county residential treatment center pending trial. She has pleaded not guilty, and her lawyers argue that the state’s homicide law does not apply to pregnant women, which is a position backed by California’s attorney general.

READ MORE: SFPD: Suspects In Violent Smash And Grab Robberies, Car Burglaries Will Be Arrested, Convicted

Prosecutors say the case is about stopping a woman who has repeatedly abused narcotics while pregnant, resulting in two other babies who tested positive for meth at birth.

Chelsea Becker mugshot (King County Sheriff)

“Despite Ms. Becker’s lengthy and continual history of using illegal narcotics and failed attempts at recovery, we maintain hope in her recovery and her ability to stop choosing drugs over her children,” said Phil Esbenshade, the top assistant district attorney in Kings County, about her release.

The case has outraged Becker’s lawyers and advocates of pregnant women who say overzealous prosecutors are trying to punish a woman who needs treatment, and not prison time, and they hope the charges will soon be thrown out. There is no evidence that drug use results in stillbirths, they say, and allowing the charges would have a chilling effect: preventing women from seeking needed prenatal care.

“We are deeply saddened, horrified that this case has been continuing for 15 months, keeping someone incarcerated because she lost a pregnancy, which thousands of women do every year,” said Lynn Paltrow, executive director of National Advocates for Pregnant Women, which is providing legal support for Becker.

California’s top prosecutor, Xavier Becerra, who is being considered for secretary of health and human services in the Biden administration, sent a friend-of-the-court brief, stating that the law was never meant to apply to pregnant women and urging the charges be dropped. The judge in this case has declined to do so.

In September 2019, Becker gave birth to a stillborn child she had named Zachariah Joseph Campos. The coroner’s report listed toxic levels of meth as the cause of death. But one of Becker’s attorneys, Dan Arshack, said the pathologist never reviewed her medical record, which included three infections that could have caused the stillbirth.

READ MORE: Walnut Creek Police Arrest Suspected Shoplifter, Recover $2000 In Stolen Merchandise

Becker had delivered three live children and had no reason to believe that meth use would cause a stillbirth, Arshack said. He declined to make Becker available for an interview.

“This was a baby she intensely wanted to have, and she remains heartbroken that it resulted in a stillbirth, like any woman who has a stillbirth,” he said, adding that the notion that she bore malice toward her child “is just prosecutorial magical thinking.”

Arshack said they are “gratified” she will not have to remain in jail and will move again to have the case dismissed.

The prosecutor, Esbenshade, said that Becker has repeatedly endangered her children with her narcotics use and rejects the idea that the law does not apply to Becker. An appeals court and the state Supreme Court have declined to intervene, saying it was too early in the legal process.

“At this point, Ms. Becker has experienced the longest period of sobriety in the past several months than she has had in her entire adult life. We have hope in her rehabilitation and her ability to stop choosing drugs over her children,” he said in a statement.

Policymakers have debated the intersection of substance use and pregnancy since the late 1980s, according to the Guttmacher Institute, a research group that works to advance sexual and reproductive rights. The highest courts in Alabama and South Carolina have upheld convictions ruling that substance use while pregnant constitutes criminal child abuse, according to the institute.

But numerous medical and public health groups, including the American College of Obstetricians and Gynecologists, oppose punishment for drug use while pregnant. There is no evidence that meth use is “uniquely and fatally dangerous” to the fetus, said two doctors in a letter submitted by Becker’s lawyers.

In California, lawmakers amended the state’s murder statute to include a fetus after the California Supreme Court in 1970 overturned the conviction of a man who had beaten a pregnant woman, causing her to lose the baby. Attempts in California in the 1990s to use the law to prosecute pregnant women failed.

MORE NEWS: Pedestrian Struck, Killed By Hit-And-Run Driver In San Jose

© Copyright 2021 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.