MONTGOMERY, Ala. (AP) — A federal judge has struck down Alabama’s one-of-a-kind law that enabled judges to put minors seeking abortions through a trial-like proceeding in which the fetus could get a lawyer and prosecutors could object to the pregnant girl’s wishes.

Alabama legislators in 2014 changed the state’s process for girls who can’t or won’t get their parents’ permission for an abortion to obtain permission from a court instead. The new law empowered the judge to appoint a guardian ad litem “for the interests of the unborn child” and invited the local district attorney to call witnesses and question the girl to determine whether she’s mature enough to decide.

ADVERTISEMENT

U.S. Magistrate Judge Susan Russ Walker sided Friday with the American Civil Liberties Union of Alabama , writing that the law unconstitutionally and impermissibly imposes “an undue burden on a minor in Alabama who seeks an abortion through a judicial bypass,” and violates the girl’s confidentiality by potentially bringing other people from her life into the process.

Both the judge and the ACLU said they were aware of no other state with such a law.

Every state requiring parental consent for abortions involving minors must also have a “judicial bypass” procedure so that girls can get a judge’s approval in a way that is effective, confidential, and expeditious, the ACLU said.

The state had argued that the law was intended to allow a “meaningful” inquiry into the minor’s maturity and the process was still a “confidential, and expeditious option for a teenager who seeks an abortion without parental consent.”

The civil rights organization said it had the opposite effect, by enabling lawyers for the state or the fetus to subpoena the minor’s teacher, neighbor, relative or boyfriend to testify she’s too immature to choose an abortion, or that continuing the pregnancy would be in her best interest.

“The problem with all that is, the very teens who find it necessary to seek judicial bypass are often vulnerable and could be subject to physical and mental abuse if it became known they are pregnant and seeking an abortion,” said Alabama ACLU’s executive director, Randall Marshall.

The ACLU filed the lawsuit in 2014 in federal court in Montgomery on behalf of Reproductive Health Services, a Montgomery abortion clinic.

ADVERTISEMENT

It is unclear how many such proceedings have happened since the law was enacted. Walker noted that a district attorney this summer opposed the abortion request of a 12-year-old girl who had been raped by an adult relative, and said it was the first case she was aware of that was decided under the new law.

The girl was 13 weeks pregnant and had just completed fifth grade when she went before a family court judge, according to a court record. The judge approved the abortion on June 27, and the district attorney appealed the same day, arguing that the girl was too immature to make an informed decision. The Alabama Court of Civil Appeals on July 12 ruled in favor of the girl.

Walker noted in a footnote of the ruling that, under the law, a girl seeking court permission for an abortion in Alabama could face both a lawyer for the fetus and “the chief prosecuting authority of the county in which the minor resides, empowered by the act to represent the state’s public policy to protect unborn life, and backed by substantial state resources.”

Marshall said the prosecutor in the 12-year-old’s case made her situation worse by delaying her ability to obtain an abortion as her pregnancy progressed into the second trimester.

A spokeswoman for the state attorney general’s office said the office is reviewing the decision.