A federal judge Friday blocked a Texas restriction set to take effect Monday that could have led to the closure of most of the abortion clinics in the state.

In a 21-page opinion, U.S. District Judge Lee Yeakel ruled that the measure, which would have required clinics performing abortions to have hospital-like building features and equipment, put an undue burden on women seeking the procedure.

The ruling drew immediate praise from abortion rights advocates, who have logged a series of courtroom victories recently in their effort to block a wave of state laws severely restricting access to the procedure.

“The court has made clear that women’s well-being is not advanced by laws attacking access to essential health care, and that rights protected by the U.S. Constitution may not be denied through laws that make them impossible to exercise,” said Nancy Northup, president of the Center for Reproductive Rights, the organization that challenged the restrictions, in a statement.

Lauren Bean, a spokeswoman for the Texas attorney general’s office, said the state would appeal. “The State disagrees with the court’s ruling and will seek immediate relief,” she said in a statement.

If the provision had been allowed to go into effect, abortion rights groups contend that all but six or seven of Texas’s remaining clinics would have been forced to close because they would not have been able to bear the cost of the required improvements.

Other restrictions enacted by the state legislature have already prompted half of the abortion clinics in the state to shut down, according to the Texas Policy Evaluation Project, a group of academics studying the impact of Texas’s abortion restrictions. A little over a year ago, the state had 41 abortion clinics, the group found. That number has shrunk to 20.

Under the provision addressed in Friday’s ruling, abortion clinics would have to meet the standards of an ambulatory surgical center and would have to look more like hospitals, with wide hallways and special cooling and heating systems. The clinics now typically resemble doctor’s offices.

State lawmakers say the rules were necessary to ensure that women who undergo abortions have them in the safest environment possible, surrounded by the equipment necessary in case of emergency. They point to instances in which women undergoing abortions have had complications, were injured, or died.

But abortion rights groups say such emergencies are exceedingly rare and that in those cases women can be transported to nearby hospitals. The groups say that lawmakers’ true intent is to reduce access to a procedure they morally oppose.

The restrictions were part of a sweeping Texas law enacted last year that dramatically reduced access to abortion in the state. It also banned the procedure after 20 weeks and limited the use of abortion-causing drugs. And it required physicians who perform abortions to have special relationships with local hospitals that allow them to admit and treat patients there.

The judge also granted a request by abortion rights groups to block the admitting privileges rule in the McAllen and El Paso areas. Because all the clinics in those areas closed, the groups said women were forced to travel too far to obtain the procedure.

“The overall effect of the provisions is to create an impermissible obstacle as applied to all women seeking a previability abortion,” the judge wrote in his opinion.