North Carolina’s ban on women having abortions after the 20th week of pregnancy is unconstitutional, a federal court ruled Monday.

But the ruling won’t go into effect immediately. The judge gave state lawmakers 60 days to either write a new abortion law or appeal his ruling.

“This court declines to act in a manner that would deprive the North Carolina legislature the opportunity, in the first instance, to either pass legislation or challenge this decision on appeal, whichever they decide may be in the interests of the citizens they represent,” wrote District Judge William Osteen.

North Carolina has had various abortion bans in state law for many decades. The 20-week ban that’s now under fire was updated by state lawmakers in 2015, and this lawsuit challenging it was filed in 2016.

Irena Como, an attorney for the American Civil Liberties Union, said in a press release that the abortion law should have been overturned because it “was written by politicians to intimidate doctors and interfere in a woman’s personal medical decisions.”

The state’s abortion ban does have exceptions for certain emergencies, but critics said it doesn’t comply with past court rulings. Osteen, who was appointed to the court by Republican President George W. Bush, agreed.

“North Carolina law criminalizes all non-emergency abortions performed after twenty weeks, without regard to the type of procedure or how the abortion is obtained,” he wrote.

Spokesmen for legislative leaders Tim Moore and Phil Berger declined to comment Tuesday, since the legislature’s legal team was in Washington, D.C., at oral arguments for a gerrymandering case and had not yet had the chance to review the abortion ruling.

The ruling was a win for Planned Parenthood, the Center for Reproductive Rights and the ACLU who sued to overturn the law.

“All decisions about pregnancy, including abortion, are deeply personal and should be decided between a woman and her doctor, without medically-unnecessary interference from politicians,” said Jenny Black, President and CEO of Planned Parenthood South Atlantic, in a press release. “This ruling affirms that right and (sends) a clear message to politicians that women deserve our care, not our judgment.”

Rev. Mark Creech, a Baptist preacher who leads the NC Christian Action League, said that regardless of the judge’s ruling, “history will one day condemn those who defend what all people will someday recognize to have been the wanton killing of innocent children.”

“A child in the womb at 20 weeks can recognize its mother’s voice,” Creech said.

Tami Fitzgerald, executive director of the socially conservative Christian group NC Values Coalition, saw a silver lining in the ruling. The judge ruled that the state can continue banning abortion once the fetus reaches viability, which is the point when it can live on its own outside the womb.

“Today’s federal court ruling confirms North Carolina lawmakers have the constitutional right to restrict abortion when the child in the womb is viable,” she said. “Our hospitals and physicians are finding viability at points once thought inconceivable just a decade ago.”

Fitzgerald also said her group will urge lawmakers to take action quickly on the ruling. “Our coalition will continue to advocate for the preborn and we will seek immediate actions during this legislative session to strengthen our State’s laws that protect the unborn,” she said.

Osteen wrote that he was not creating any new precedent but simply following other federal legal decisions. He pointed specifically to cases out of Arizona, Arkansas, Idaho, Mississippi, North Dakota and Utah that dealt with this or similar topics.

According to the Center for Reproductive Rights, which is one of the plaintiffs in the case, “every time a court has considered the constitutionality of a 20 week ban, it has been blocked.”