AUSTIN, Tex. — A federal judge on Wednesday struck down a Texas law that would have required abortion providers and other health care facilities to bury or cremate fetal remains, the latest in a series of legal setbacks for anti-abortion activists and state Republican leaders who pushed for the law.

The Texas Legislature passed the law in 2017. It would have required hospitals, abortion clinics and other providers to arrange for the burial or cremation of fetal remains, regardless of a patient’s personal wishes or religious beliefs, and regardless of whether the remains were from an abortion or miscarriage.

David A. Ezra, a senior judge with the Federal District Court in Austin, issued a permanent injunction that blocks enforcement of the law, which had been set to go into effect in February. Texas abortion providers had won a temporary injunction earlier; Judge Ezra issued his final ruling on Wednesday following a five-day trial in Austin in July.

In some ways, the case was a sequel to Texas’ most significant courtroom battle on abortion — the three-year fight over what had been one of the toughest anti-abortion laws in the country, a battle that ended in 2016 when the United States Supreme Court tossed out two of the law’s main provisions. One required clinic doctors performing abortions to obtain admitting privileges at a nearby hospital, and the other mandated that all clinics meet the same standards as hospital-style surgical centers.