South Carolina Gov. Nikki Haley (R) has signed into law a bill that will ban most abortions in the state after 20 weeks of pregnancy.

The Pain-Capable Unborn Child Protection Act takes effect July 1 and makes South Carolina the 17th state to restrict abortion after five months – more than halfway through pregnancy – because of the unborn child’s ability to feel pain.

The measure passed the South Carolina House of Representatives 79-29 on Tuesday.

The only exceptions to the law are in the rare situation in which the mother’s life is in jeopardy and if a physician determines the baby cannot survive outside the womb.

Similar bans are now in effect in Alabama, Arkansas, Indiana, Kansas, Louisiana, Mississippi, Nebraska, North Dakota, Oklahoma, South Dakota, Texas, West Virginia and Wisconsin. The states of Idaho, Arizona, and Georgia have also passed 20-week abortion bans that have been blocked by courts.

Physicians who violate the law will be charged with a misdemeanor offense which carries with it a maximum sentence of three years of prison time, plus a potential fine.

Planned Parenthood expressed its disapproval of the ban on abortions past the fifth month of pregnancy, referring to it as “extremist” on Twitter:

BREAKING: Gov. @nikkihaley has signed the bill banning safe, legal abortion at 20 wks, into law. https://t.co/vFlezUp63H #stopthebansc — PP South Atlantic SC (@PPSATSC) May 25, 2016

Putting politics over policy is dangerous and unacceptable. But that's what extremists in South Carolina just did: https://t.co/AelwMG2YtL — Planned Parenthood Action (@PPact) May 26, 2016

Despite protests & the lack of public support, South Carolina passed a 20 wk abortion ban. https://t.co/JSzCYmEPU2 pic.twitter.com/tlAWmyMiMP — Planned Parenthood Action (@PPact) May 26, 2016

“We are incredibly disappointed in Gov. Haley for signing HB 3114 into law today,” Jenny Black, president and CEO of Planned Parenthood South Atlantic, said in a statement, reports The Post and Courier. “In reality, abortion later in pregnancy is extremely rare and often takes place in difficult and complicated situations where a woman and her doctor need every medical option available.”

Dr. Scott Sullivan, the director of maternal-fetal medicine at the Medical University of South Carolina, asked Haley to veto the bill.

“But I’ll just keep doing what we always do, trying to help families in need,” he said. “This just makes it harder.”

State Sen. Chip Campsen (R) supported the measure and said, “I believe that an unborn child is human life and therefore I am compelled to be opposed to abortion except if the life of the mother is threatened.”