A pregnant Wisconsin woman has filed a federal challenge to the state’s fetal protection law after being confined in a drug treatment center for more than two months, even though she said she’d already weaned herself off a dependence on painkillers.

Alicia F. Beltran was held this summer under a 1997 Wisconsin law that allows officials to force women into treatment to protect their unborn children.

Three other states — Minnesota, Oklahoma and South Dakota — have similar laws, said Farah Diaz-Tello, a staff attorney for the advocacy group that helped bring the case. Beltran’s challenge is the first constitutional test of the law, Diaz-Tello said.

According to court documents, Beltran, 28, of Jackson, was about three months pregnant in July when she went to a clinic in West Bend for a prenatal checkup. She told a physician’s assistant that she’d just finished treatment for what she thought was a problem with the painkiller Percocet. The physician’s assistant contacted a social worker, who suggested Beltran continue taking an anti-addiction drug. Beltran declined.

She was arrested days later and eventually taken to a drug treatment facility in Appleton, where she was held even though a urine test showed no evidence of drug use. The New York Times reported Beltran was held at the clinic until earlier this month, after the federal challenge was filed on her behalf last month in Milwaukee.

The challenge asks the federal court to declare the law unconstitutional, saying it punishes pregnant women and violates their rights to privacy, due process, and freedom from illegal searches and seizures. It names as defendants the Casa Clare drug treatment center and several Washington County officials.

Washington County District Attorney Mark Bensen declined to talk about Beltran’s case in detail but said she was never charged with a crime. He also said the fact that she received treatment was positive. Casa Clare executive director Jamie Loenish did not immediately return a message seeking comment.

Sue Armacost, the legislative director of anti-abortion group Wisconsin Right to Life, said she didn’t know enough about the case to comment on it, but her group has supported the law since it passed in 1997.

“We think this law is really a compassionate one,” Armacost said. “You have a mom who was addicted to drugs, habitually taking drugs. For her sake and the sake of the baby, we just thought it was a compassionate thing to do to get the baby into custody and the mom to get real help.”

Beltran’s legal challenge, filed Sept. 30, is in the form of a petition seeking her release from the treatment facility. She already was released earlier this month, but Diaz-Tello said Beltran remains under the state’s control and could be forced back to the facility at any point.

“This petition is essentially a federal challenge to her incarceration and to the law,” said Diaz-Tello, an attorney with the National Advocates for Pregnant Women.

During Beltran’s initial hearing, the court assigned an attorney to represent the fetus but told Beltran she had no right to her own counsel until the next hearing, Diaz-Tello said. While the Constitution guarantees the right to counsel, Diaz-Tello said that didn’t apply here because this was a civil case, not criminal.

“That’s the way the Wisconsin statute was written,” she said. “It’s particularly egregious.”

It’s hard to say how often pregnant women in the four states have been committed under fetus protection laws. Diaz-Tello said the hearings are generally conducted in closed proceedings because the fetuses, and sometimes even adult mothers, are considered juveniles.

In addition to Beltran’s federal case, there is also a state case to determine whether her child would require intervention from the state’s child protection services.

“This hearing will determine whether or not she has abused or neglected a child who’s not even due to be born until January,” Diaz-Tello said.

Diaz-Tello said she instructed Beltran not to speak to reporters without her local lawyer present. A message for that lawyer, Linda Vanden Heuvel, was not immediately returned.