Image copyright ACLU

A judge has rejected an Alabama law that puts teenage girls seeking abortions through a court-like process with a lawyer representing the foetus.

The 2014 law requires pregnant girls who want abortions without parental consent to notify a district attorney.

But a federal judge sided with the American Civil Liberties Union (ACLU) and ruled the law unconstitutional and a violation of a girl's privacy.

The state argued it was intended to determine a minor's maturity.

State lawyers also contended the law was still a "confidential, and expeditious option for a teenager who seeks an abortion without parental consent".

The law granted judges the power to appoint a lawyer for the foetus, known as guardian ad litem, and allowed prosecutors to question the girl to decide whether she's mature enough for an abortion during a trial-like proceeding.

The ACLU argued that process allowed prosecutors to call to witness a girl's parents, teachers or friends to help determine if she is too immature to have an abortion, which could subject them to physical or mental abuse.

Since 1987, girls aged under 18 in the state must get permission from her parents before she can get an abortion, but a judicial bypass was available if the girl could show her mental maturity in cases which involved abuse.

The legislation in 2014 mean parents or a legal guardian could appeal against the judicial bypass, thereby delaying the procedure until the girl could no longer seek an abortion.

US Magistrate Judge Susan Russ Walker on Friday said the law unconstitutionally placed "an undue burden on a minor in Alabama who seeks an abortion through a judicial bypass" and breaches confidentiality by involving other people from her life.

The abortion debate

Media playback is unsupported on your device Media caption Why one woman decided to terminate her pregnancy - and defends Planned Parenthood

Media playback is unsupported on your device Media caption Jeanne Mancini organises March for Life, a major anti-abortion rally in the US

It is unclear how many cases have been tried under the law, but Judge Walker said earlier this summer a district attorney objected to an abortion request by a 12-year-old girl who had been raped by an adult relative.

The girl was 13 weeks pregnant when she appeared before a family court judge, records show.

A judge granted the abortion on 27 June and a district attorney appealed against the decision the same day.

However, the Alabama Court of Civil Appeals sided with the girl on 12 July.

Media playback is unsupported on your device Media caption Amy has to travel eight hours for an abortion

The ACLU, which represented the Montgomery abortion clinic Reproductive Health Services in the lawsuit, hailed the decision as "a victory for women, for young people, and for reproductive health in Alabama".

The Alabama attorney general's office, which defended the law, said in a statement on Monday it was reviewing the ruling.