WASHINGTON – The Supreme Court on Monday struck down a Louisiana law that could have left the state with a single abortion clinic, dashing the hopes of conservatives who were counting on President Donald Trump’s appointments to lead the court to sustain restrictions on abortion rights and, eventually, to overrule Roe v. Wade.

Instead, conservatives suffered a setback, and from an unlikely source. Chief Justice John Roberts added his crucial fifth vote to those of the court’s four-member liberal wing, saying that respect for precedent compelled him to do so, even though he had voted to uphold an essentially identical Texas law in a 2016 dissent.

In the past two weeks, Roberts has voted with the court’s liberal wing in three major cases — on job discrimination against lesbian, gay, bisexual and transgender workers; on a program protecting young immigrants known as Dreamers, and now on abortion. While the chief justice has on occasion disappointed his usual conservative allies, notably on the Affordable Care Act and adding a citizenship question to the census, nothing in his 15-year tenure compares to the recent run of liberal votes in major cases.

Justice Stephen Breyer, writing for the four other justices in the majority, said the Louisiana law was “almost word-for-word identical” to the one from Texas that the Supreme Court struck down in the 2016 decision.

In both cases, Breyer wrote, the laws put an undue burden on the constitutional right to the procedure.

The court’s decision to revisit the issue of admissions privileges worried proponents of abortion rights given Roberts’ support for the Texas law. Since that ruling, Justice Anthony Kennedy, who voted to overturn the law, was replaced by the more conservative Justice Brett Kavanaugh. In the end, Roberts’ commitment to precedent sank the Louisiana law.

“I joined the dissent in Whole Woman’s Health (the Texas case),” he wrote Monday, “and continue to believe that the case was wrongly decided. The question today, however, is not whether Whole Woman’s Health was right or wrong, but whether to adhere to it in deciding the present case.

“The Louisiana law imposes a burden on access to abortion just as severe as that imposed by the Texas law, for the same reasons,” the chief justice wrote. “Therefore Louisiana’s law cannot stand under our precedents.”

Still, it would be hasty to conclude that he was prepared to strike down other abortion restrictions or that he would vote to sustain the Roe decision, which in 1973 established a constitutional right to abortion, should a direct challenge to the ruling reach the court.

White House press secretary Kayleigh McEnany expressed disappointment.

“In an unfortunate ruling today,” she said in a statement, “the Supreme Court devalued both the health of mothers and the lives of unborn children by gutting Louisiana’s policy that required all abortion procedures be performed by individuals with admitting privileges at a nearby hospital.”

Joe Biden, the presumptive Democratic presidential nominee, issued a statement saying that “women’s health care rights have been under attack as states across the country have passed extreme laws restricting women’s constitutional right to choice under any circumstance.”

The Louisiana law at issue in the new case was enacted in 2014. It required doctors performing abortions to have admitting privileges at nearby hospitals.

On Monday, Breyer wrote that the Louisiana law would severely restrict abortion as a practical matter.

Justices Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan joined Breyer’s plurality opinion.

In dissent, Justice Samuel Alito, joined by Justices Clarence Thomas, Gorsuch and Kavanaugh, wrote that the Louisiana law protects the health and safety of women seeking abortions and that the requirements for obtaining admitting privileges helps ensure the competence of doctors. The facts on the ground in the two states, he wrote, were enough to require a different conclusion.

“There is ample evidence in the record showing that admitting privileges help to protect the health of women by ensuring that physicians who perform abortions meet a higher standard of competence than is shown by the mere possession of a license to practice,” Alito wrote. “In deciding whether to grant admitting privileges, hospitals typically undertake a rigorous investigative process to ensure that a doctor is responsible and competent and has the training and experience needed to perform the procedures for which the privileges are sought.”

Roberts disagreed.

“Appreciating that others may in good faith disagree,” he wrote, “I cannot view the record here as in any pertinent respect sufficiently different from that in Whole Woman’s Health to warrant a different outcome.”