HOUSTON — A Fort Worth hospital that kept a pregnant, brain-dead woman on life support for two months followed a judge’s order on Sunday and removed her from the machines, ending her family’s legal fight to have her pronounced dead and to challenge a Texas law that prohibits medical officials from cutting off life support to a pregnant woman.

On Friday, a state district judge ordered John Peter Smith Hospital to remove the woman, Marlise Muñoz, from life-support machines by 5 p.m. on Monday. The judge ruled that the state law barring doctors from withdrawing “life-sustaining treatment” to pregnant women did not apply to Ms. Muñoz because she was brain-dead and therefore legally dead. The hospital had refused to honor the family’s request to disconnect her, claiming that the law prevented them from doing so until they could perform a cesarean delivery.

But on Sunday, the hospital decided against appealing the judge’s decision and announced that it would follow his ruling. The J.P.S. Health Network, which runs John Peter Smith Hospital as part of the taxpayer-financed county hospital district, said in a statement that the past several weeks had been difficult for both the family of Ms. Muñoz and her caregivers, but it defended its handling of the case.

“J.P.S. Health Network has followed what we believed were the demands of a state statute,” said a spokeswoman, Jill Labbe. “From the onset, J.P.S. has said its role was not to make nor contest law but to follow it.”