A federal judge on Friday struck down a Arkansas abortion law aimed at outlawing nearly all abortions in the state after 12 weeks.

The law said that if at 12 weeks a fetal heartbeat could be heard through a normal ultrasound, the woman could not have an abortion. Any doctor found breaking the law could see their license pulled, reports Reuters.

The woman could still get an abortion after the 12-week mark provided her life was in danger, problems were detected in the fetus or the fetus was the result of incest or rape.

U.S. District Judge Susan Webber Wright ruled that the Arkansas Human Heartbeat Protection Act was unconstitutional because of the issue of viability. The law "impermissibly infringes a woman's Fourteenth Amendment right to elect to terminate a pregnancy before viability," she ruled.

Viability, or when the fetus could survive outside of the womb, is usually at around 22 or 24 weeks, notes The Associated Press, Citing previous court decisions, Wright wrote in her ruling, "The state presents no evidence that a fetus can live outside the mother's womb at 12 weeks."

The entire law was not struck down, however, as a provision that forces doctors to look for a heartbeat and inform the woman if there is one found was allowed to stand.

The bill originally had been vetoed last year by Gov. Mike Beebe, but Republican legislators were able to override him, though it mattered little as the bill was prevented from going into effect as the court looked into it.