A state law requiring women to bury or cremate fetal remains from miscarriages and abortions has been blocked by a federal judge.

A federal judge blocked Texas’ fetal burial law on Wednesday, writing that the legislation would “likely cause a near catastrophic failure of the healthcare system designed to serve women of childbearing age within the State of Texas.”

In a scathing 53-page ruling, U.S. District Judge David Ezra found that the law, which mandates burial or cremation of fetal remains following abortions and miscarriages at all medical facilities in the state, constituted an undue burden on abortion access, placing “substantial obstacles” to medical care “while offering minimal benefits.”

“Make no mistake, these restrictions were designed to shame and stigmatize patients and health care providers,” said Amy Hagstrom Miller, president of Whole Woman’s Health, a plaintiff in the case. “This decision reaffirms that Texan women are fully capable of making their own personal medical decisions about their families, futures and reproductive health care.”

The ruling follows a weeklong trial in July, in which the plaintiffs — a group of Texas abortion clinics and other health providers — argued that the law infringes on patients’ freedom of speech and religion and their access to health care. Included as a witness was Blake Norton, who told how a Catholic hospital in Austin forced her to consent to the burial of the remains of her miscarriage in 2015. Norton first shared her story publicly with the Observer earlier this year, because she worried her experience would become routine for women across Texas under the new legislation.

The state’s attorneys, on the other hand, argued that the law is necessary to show “profound respect for the life of the unborn” through “dignified disposition of fetal remains.” On this point, Ezra wrote that he “declines to rule” that Texas “does not have a legitimate interest in enacting a well thought-out and workable statute that accomplishes the asserted purpose of respecting potential life by providing for the dignified disposition of embryonic and fetal tissue remains.” But, he said, the so-called fetal burial law burdens patients by imposing the state’s idea of what is appropriate.

“At best, enshrining the State’s view of pregnancy increases the grief, stigma, shame, and distress of women experiencing an abortion, whether induced or spontaneous,” Ezra wrote.

Further, Ezra said the state did not prove it has a plan to ensure that medical providers are able to meet the law’s burial and cremation requirements. During the trial, state attorneys called as witnesses employees at funeral homes that had agreed to take the remains, but Ezra said the offers were vague and insufficient.

“The simple fact is that Texas currently has no viable, integrated system in place for disposing of embryonic and fetal tissue remains in compliance with the challenged laws,” Ezra wrote.

The decision carries a whiff of déjà vu for those who have followed this issue. In July 2016, the Texas Health and Human Services Commission issued a similar burial and cremation rule, which was blocked the following year by U.S. District Judge Sam Sparks in Austin. Sparks said that the rule was politically motivated and chided state officials for issuing rapid-fire abortion restrictions after their loss at the U.S. Supreme Court just days before, drafting new regulations “before the ink on the Supreme Court’s opinion in Whole Woman’s Health was dry.” The state appealed Sparks’ decision to the U.S. Fifth Circuit Court of Appeals, but later dismissed it after the Legislature passed the requirement as a law this spring.

“This decision reaffirms that Texan women are fully capable of making their own personal medical decisions about their families, futures and reproductive health care.”

Ezra’s ruling is the latest but likely not the last decision in what is already a lengthy legal battle. Attorney General Ken Paxton is expected to appeal the case to the Fifth Circuit, where another provision from the same sweeping anti-abortion law passed last session (a ban on the most common form of second-trimester procedure) is currently awaiting appeal. Anti-abortion groups have said that they expect a more favorable ruling on both measures from the conservative appeals court. Paxton said immediately following the decision Wednesday that he would continue to “fight to uphold the law” and “honor the dignity of the unborn.”