(Reuters) - A U.S. judge on Thursday struck down two abortion restrictions in Alabama that limited how close clinics can be to public schools and banned a procedure used to terminate pregnancies in the second trimester.

The decision is a blow to abortion opponents in Alabama, who have joined conservatives in other states in enacting new laws that critics said were chipping away at the U.S. Supreme Court’s 1973 Roe v. Wade decision legalizing abortion.

U.S. District Judge Myron Thompson in the Middle District of Alabama found the laws unconstitutional and permanently enjoined the state from enforcing the measures, which were signed into law in May 2016 by former Alabama Governor Robert Bentley, a Republican.

The same court last year temporarily blocked both measures in a preliminary injunction, which was under appeal to the 11th Circuit Court of Appeals.

The school-proximity law banned clinics within 2,000 feet of a K-8 public school and was the only law of its kind in the United States. Thompson said it would likely have forced the closing of clinics in Huntsville and Tuscaloosa, where 72 percent of the state’s abortions are performed.

The “fetal-demise law,” which effectively banned the most common method of second-trimester abortion, known as dilation and evacuation, would have prohibited abortions after 15 weeks, Thompson wrote.

“Because these laws clearly impose an impermissible undue burden on a woman’s ability to choose an abortion, they cannot stand,” he wrote.

The ACLU of Alabama had challenged the laws on behalf of two women’s health clinics in a state where abortion providers have faced what Thompson’s ruling called a “climate of hostility.”

“Both would have had a devastating impact on the ability of women to access abortion in Alabama,” said Randall Marshall, executive director of the ACLU of Alabama.

Alabama’s Attorney General and Republican Governor Kay Ivey’s office did not respond to requests for comment.

U.S. state legislatures enacted 41 new abortion restrictions in the first half of 2017, according to the Guttmacher Institute, a reproductive health think tank that supports abortion rights.

Those laws have led to a spate of legal challenges in Alabama and elsewhere. Last year, the U.S. Supreme Court struck down parts of a Texas law that required clinics to meet hospital-like standards and for clinic doctors to have admitting privileges at nearby hospitals.