AUSTIN, Texas -- U.S. District Judge David Alan Ezra struck down a Texas law on Wednesday that would have required hospitals and clinics to bury or cremate fetal remains.

The ruling caused another courtroom setback for anti-abortion groups.

RELATED |Federal judge temporarily blocks forthcoming Texas fetal burial law

Abortion providers argue the law places an "undue burden" on women seeking medical care and infringes upon their personal beliefs. Whole Woman’s Health said its diverse range of patients do not always share the state’s views. 

U.S. District Judge David Ezra said the requirement would put "substantial obstacles" in the path of a women's right to an abortion. He had already issued a temporary injunction against the measure earlier this year

Lawyers for the Office of the Attorney General said the law, which passed in the last legislative session but has yet to be enforced, simply ensures the dignified disposition of fetal remains after an abortion or a miscarriage. Under the law, fetal remains would not be able to be disposed of in landfills or sewage systems.

MORE | Abortion access groups continue fight against fetal disposal rules

The restriction is part of Texas Senate Bill 8, sweeping legislation that includes several prohibitions related to abortions. 

Attorney General Ken Paxton announced that his office will continue fighting to "honor the dignity of the unborn."

“Today’s ruling is disappointing, but I remain confident the courts will ultimately uphold the Texas law, which honors the dignity of the unborn and prevents fetal remains from being treated as medical waste” Attorney General Paxton said. “We established during a weeklong trial in July that the law is constitutional and does not impact the abortion procedure or the availability of abortion in Texas. My office will continue to fight to uphold the law, which requires the dignified treatment of fetal remains, rather than allow health care facilities to dispose of the remains in sewers or landfills.”