The Oklahoma Supreme Court has tossed out a restrictive abortion law that effectively limited women’s access to a termination.

On Tuesday the high court struck down S.B. 1848, a law that required doctors performing abortions to have so-called hospital admitting privileges.

The requirement stipulated that doctors have pre-authorization from an accredited hospital within 30 miles of where an abortion is performed that would allow an abortion provider to bring their patient to the hospital for treatment in case of an emergency. Abortion access advocates blamed the law and others like it in other states for the rapid closure of abortion clinics saying it particularly impacts rural areas.

Oklahoma’s law placed an unconstitutional “undue burden on a woman’s access to abortion,” the court ruled. The move overturns a lower court’s February decision that upheld it.

The law has sparked an intense legal battle since Republican Gov. Mary Fallin signed it in 2014.

The law’s supporters ― largely anti-abortion activists ― claimed it was geared at protecting women’s health. Reproductive rights advocates, however, characterized the law as a medically unnecessary sham meant to further restrict women’s access to abortion.

Similar laws were enacted in states like Louisiana and Texas, both of which were struck down this year by the U.S. Supreme Court.

The court has ruled that the hospital admitting privileges requirement does not provide a health or safety benefit that outweighs the undue burden it creates for women seeking an abortion.

According to Tuesday’s ruling in Oklahoma, expert testimony noted that women experiencing complications from abortion that would require hospitalization are unlikely and that in the rare cases it may occur, “the quality of care that the patient receives is not affected by whether the abortion provider has admitting privileges at the hospital.”

Opponents of the law note that hospitals must admit patients whose lives are in danger, regardless of the situation.