By a 5-3 vote, the justices rejected the state’s arguments that its 2013 law and follow-up regulations were needed to protect women’s health. The rules required doctors who perform abortions to have admitting privileges at nearby hospitals and forced clinics to meet hospital-like standards for outpatient surgery.

The clinics that challenged the law argued that it was merely a veiled attempt to make it harder for women to get abortions by forcing the closure of more than half the roughly 40 clinics that operated before the law took effect.

Justice Stephen Breyer’s majority opinion for the court held that the regulations are medically unnecessary and unconstitutionally limit women’s right to abortions.

Breyer wrote that “the surgical-center requirement, like the admitting privileges requirement, provides few, if any, health benefits for women, poses a substantial obstacle to women seeking abortions and constitutes an ‘undue burden’ on their constitutional right to do so.”

Thirteen states have similar requirements, enacted as part of a wave of abortion restrictions that states have imposed in recent years. Others include limits on when in a pregnancy abortions may be performed and the use of drugs that induce abortions without surgical intervention.

Amy Hagstrom Miller, the owner of several Texas clinics among her eight facilities in five states, predicted that the decision would “put a stop to this trend of copycat legislation.”

Texas Attorney General Ken Paxton said the law “was an effort to improve minimum safety standards and ensure capable care for Texas women. It’s exceedingly unfortunate that the court has taken the ability to protect women’s health out of the hands of Texas citizens and their duly elected representatives.”

Ginsburg wrote a short opinion noting that laws like Texas’ “that do little or nothing for health, but rather strew impediments to abortion, cannot survive judicial inspection” under the court’s earlier abortion-rights decisions. She pointed specifically to Roe v. Wade in 1973 and Planned Parenthood v. Casey in 1992, of which Kennedy was one of three authors.

Thomas wrote that the decision “exemplifies the court’s troubling tendency ‘to bend the rules when any effort to limit abortion, or even to speak in opposition to abortion, is at issue.'” Thomas was quoting an earlier abortion dissent from Justice Antonin Scalia, who died in February. Scalia has not yet been replaced, so only eight justices voted.

Alito, reading a summary of his dissent in court, said the clinics should have lost on technical, procedural grounds. Alito said the court was adopting a rule of, “If at first you don’t succeed, sue, sue again.”

Abortion providers said the rules would have cut the number of abortion clinics in Texas to fewer than 10 if they had been allowed to take full effect.

Nancy Northup, president of the Center for Reproductive Rights, which represented the clinics, said, “The Supreme Court sent a loud and clear message that politicians cannot use deceptive means to shut down abortion clinics.”

President Barack Obama praised the decision, saying, “We remain strongly committed to the protection of women’s health, including protecting a woman’s access to safe, affordable health care and her right to determine her own future.”

Democratic presidential candidate Hillary Clinton called the outcome “a victory for women in Texas and across America.”

Abortion opponents had hoped Kennedy, who wrote a 2007 opinion upholding a federal ban on a certain type of abortion, would conclude that states can enact health-related measures to make abortions safer.

Instead, he sided with his four more liberal colleagues.

The court “has stripped from states the authority to extend additional protections to women such as clinic safety standards or admitting privilege requirements for abortionists,” said Notre Dame University law professor Carter Snead.

Texas is among 10 states with similar admitting-privileges requirements, according to the Center for Reproductive Rights. The requirement is in effect in most of Texas, Missouri, North Dakota and Tennessee. It is on hold in Alabama, Kansas, Louisiana, Mississippi, Oklahoma and Wisconsin.

The hospital-like outpatient surgery standards are in place in Michigan, Missouri, Pennsylvania and Virginia, and are blocked in Tennessee and Texas, according to the center.

Texas passed a broad bill imposing several abortion restrictions in 2013. Clinics won several favorable rulings in a federal district court in Texas. But each time, the New Orleans-based 5th U.S. Circuit Court of Appeals sided with the state

Breyer’s opinion was a rebuke of the appeals court and a vindication for U.S. District Judge Lee Yeakel, who had held a trial on the challenged provisions and struck them down.

Separate lawsuits are pending over admitting-privileges laws in Louisiana and Mississippi, the other states covered by the 5th circuit. The laws are on hold in both states, and a panel of federal appellate judges has concluded the Mississippi law probably is unconstitutional because it would force the only abortion clinic in the state to close.