WASHINGTON — The U.S. Supreme Court struck down Texas’ widely replicated regulation of abortion clinics today in the court’s biggest abortion case in nearly a quarter century.

The justices voted 5-3 in favor of Texas clinics that had argued the regulations were only a veiled attempt to make it harder for women to get abortions in the nation’s second-most populous state.

Justice Stephen G. Breyer’s majority opinion for the court held that the regulations are medically unnecessary and unconstitutionally limit a woman’s right to an abortion.

Texas had argued that its 2013 law and subsequent 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.

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.”

Justices Anthony M. Kennedy, Ruth Bader Ginsburg, Sonia M. Sotomayor and Elena Kagan joined Breyer.

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.

Chief Justice John G. Roberts Jr. and Justices Samuel A. Alito Jr. and Clarence Thomas dissented.

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 G. 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.”

Meanwhile, the court’s ruling likely means the end of a similar Wisconsin law.

A similar law Wisconsin Republicans passed in 2013 regarding admitting privileges was struck down by the 7th U.S. Circuit Court of Appeals in November 2015.

Wisconsin attorneys petitioned the Supreme Court in March 2016 to reverse that decision. It’s unlikely the court will take up the case following its ruling on the nearly identical Texas law.

“The ruling today should have reverberations throughout the country,” said Jennifer Dalven, director of the American Civil Liberties Union’s Reproductive Freedom Project.

Back in Texas, abortion providers said the rules would have cut the number of abortion clinics in the state by three-fourths if they had been allowed to take full effect.

When then-Gov. Rick Perry signed the law in 2013, there were about 40 clinics throughout the state. That number dropped to under 20 and would have been cut in half again if the law had taken full effect, the clinics said.

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.”

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. “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.”

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 it is blocked in Tennessee and Texas, according to the center.

Texas passed a broad bill imposing several abortion restrictions in 2013. Texas clinics sued immediately to block it, contending it impermissibly interfered with a woman’s constitutional right to an abortion. The 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, at first allowing challenged provisions to take effect and then upholding the law with only slight exceptions.

The Supreme Court had allowed the admitting-privileges requirement to take effect in most of the state, but put the surgical center provision on hold pending the court’s resolution of the case.

The justices split largely along liberal-conservative lines in their emergency orders, with the court’s conservative justices voting repeatedly to let the law be enforced.

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.

Associated Press writer Bryna Godar in Madison, Wis., conttributed to this article.