A three-judge federal appeals panel dismissed a lawsuit Monday that challenged Wisconsin’s so-called “cocaine mom” law, saying the case is moot because the woman who brought the action has moved out of state.

The lawsuit was filed in 2014 by then-Wisconsin resident Tammy Loertscher, who claimed her rights were violated when she was jailed during her pregnancy after testing positive for methamphetamine and refusing to enter drug treatment.

State law permits the detention of pregnant women who are suspected of abusing drugs. Last year, a U.S. District Court judge found the law unconstitutional and issued an injunction barring it from being enforced. But the law remained in effect while the state appealed.

On Monday, the 7th U.S. Circuit Court of Appeals panel said Loertscher left Wisconsin, so she no longer needs protection from the statute.

Opponents of the law — including the American College of Obstetricians and Gynecologists, American Society of Addiction Medicine and American Public Health Association — have argued it discourages pregnant women who are struggling with addiction from seeking prenatal care, and that it is vague and overly punitive.

“Today’s decision means that all women in Wisconsin have to worry that when they seek health care, if there’s even a chance they might be pregnant, the state can take them into custody, lock them up in a drug treatment program, a mental hospital or a jail — whether or not drug treatment is really needed,” said Nancy Rosenbloom, director of legal advocacy for the National Advocates for Pregnant Women, which represented Loertscher.

Republican Attorney General Brad Schimel applauded the ruling: “Given Wisconsin’s drug crisis, the Unborn Child Protection Act is more important now than ever before.” He added that law enforcement and human services workers have used the law “for many years to aid drug-addicted women and will now be able to continue their important work that makes mothers and children safer and stronger.”

The law, passed in 1998, is meant to provide protection for developing fetuses. If an adult pregnant woman is suspected of drug or alcohol use that could affect their fetus, she can be ordered into custody or involuntary medical treatment.

While two other states — Minnesota and South Dakota — have laws relating to the civil commitment of pregnant women who abuse drugs, Wisconsin’s law is unique because it puts a pregnant woman under the jurisdiction of juvenile court, where the fetus is appointed a guardian ad litem and proceedings are confidential, Rosenbloom said.

“The fact that not a single other state has adopted a law like this is another indication of how outside the realm of reason, public health and family well-being this law is,” said Lynn Paltrow, founder and executive director of National Advocates for Pregnant Women.

In striking down the law last year, U.S. District Judge James Peterson ruled that its language was unclear on both the amount of drug or alcohol use by pregnant women that should prompt state action, and what constituted “substantial risk” to the health of the fetus.

In this case, Loertscher was 14 weeks pregnant and living in Medford in 2014 when tests showed traces of methamphetamine in her body. She told a doctor she had stopped using when she thought she was pregnant. But a judge ordered her into inpatient drug treatment. When she refused, she was jailed until she agreed to drug testing throughout her pregnancy.

Loertscher, who gave birth to a healthy boy in 2015, has the option to appeal.