A federal judge in Idaho has barred the state from enforcing a strict abortion ban in medical emergencies over concerns that it violates a federal law on emergency care.

The ruling Wednesday evening came after a federal judge this week in Texas made the opposite call, barring the federal government from enforcing a legal interpretation of the Emergency Medical Treatment and Labor Act that would require Texas hospitals to provide abortion services if the health or life of the mother is at risk.

In Idaho, the ban makes performing an abortion in any “clinically diagnosable pregnancy” a felony punishable by up to five years in prison. Much of Idaho’s law will still go into effect Thursday, but U.S. District Judge B. Lynn Winmill ruled Wednesday the state cannot prosecute anyone who is performing an abortion in an emergency medical situation.

That’s because abortions in those cases appear to fall under a federal health care law requiring Medicare-funded hospitals to provide “stabilizing treatment” to patients, Winmill said.

FILE – People march through 8th Street in downtown Boise, Idaho, on May 3, 2022, in response to the news that the U.S. Supreme Court could be poised to overturn the landmark Roe v. Wade case that legalized abortion nationwide. On Saturday, Aug. 13, 2022, a federal judge said the Idaho Legislature can intervene in the U.S. Department of Justice lawsuit targeting Idaho’s total abortion ban, but only to present evidence about emergency abortions performed in Medicaid-funded emergency rooms. (Sarah A. Miller/Idaho Statesman via AP, File)

That includes cases when the health of a pregnant patient is in serious jeopardy, when continuing the pregnancy could result in a serious impairment to a person’s bodily functions, or a serious dysfunction of any bodily organ or part.

The pause on enforcement in Idaho will continue until a lawsuit challenging the ban is resolved, the judge said in the written ruling.

The U.S. Department of Justice sued the Republican-led state of Idaho earlier this month, saying the abortion ban set to take effect on Thursday violates the federal Emergency Medical Treatment and Labor (EMTALA) Act . Idaho’s law criminalizes all abortions in “clinically diagnosable pregnancies,” but allows physicians to defend themselves in court by arguing the procedure was necessary to avert the death of the mother.

Idaho Attorney General’s spokesman Scott Graf said his office would not comment on the ruling because the case is still working its way through the courts.

Winmill said the case wasn’t about abortion rights but about whether state or federal law takes precedence in this situation. The judge in the Idaho case said it was clear federal law did.

Winmill said the Idaho law would pose a dilemma for a doctor who felt they had to, under “EMTALA obligations,” perform an abortion to save the life of the mother even though they are banned under state law.

“At its core, the Supremacy Clause says state law must yield to federal law when it’s impossible to comply with both. And that’s all this case is about,” Winmill wrote. “It’s not about the bygone constitutional right to an abortion.”

FILE – Demonstrators march and gather near the Texas state Capitol in Austin following the Supreme Court’s decision to overturn Roe v. Wade on June 24, 2022. A federal judge in Texas issued a ruling on Tuesday, Aug. 23, 2022, temporarily blocking the federal government from enforcing guidance against the state that requires hospitals to provide abortion services if the life of the mother is at risk. (AP Photo/Eric Gay, File)

In Texas, a federal judge took the opposite approach. Texas had sued Department of Health and Human Services and Secretary Xavier Becerra last month, arguing the federal law commonly referred to as EMTALA doesn’t require doctors to provide abortions if doing so would violate a state law.

In a ruling late Tuesday, U.S. District Judge James Wesley Hendrix temporarily blocked the government from enforcing the guidance in Texas, saying it would force physicians to place the health of the pregnant person over that of the fetus or embryo even though EMTALA “is silent as to abortion.”

Performing an abortion creates an “emergency medical condition” in the fetus or embryo, the judge wrote.

“Since the statute is silent on the question, the Guidance cannot answer how doctors should weigh risks to both a mother and her unborn child,” the judge’s order said. “Nor can it, in doing so, create a conflict with state law where one does not exist. The Guidance was thus unauthorized.”

The Department of Health and Human Services said it was reviewing the legal decision to determine its next steps.

White House Press Secretary Karine Jean-Pierre called the Texas decision, “a blow to Texans,” saying pregnant women in Texas may now be denied appropriate treatment for conditions such as dangerously high blood pressure or severe bleeding.

“It’s wrong, it’s backwards, and women may die as a result. The fight is not over,” Jean-Pierre said in a statement.

The Department of Health and Human Services issued the guidance in July, weeks after the U.S. Supreme Court ruled that abortion is not a constitutional right.

The agency cited EMTALA requirements on medical facilities to determine whether a person seeking treatment might be in labor or whether they face an emergency health situation — or one that could develop into an emergency — and to provide stabilizing treatment.

Texas argued that the EMTALA guidelines also violated the Religious Freedom Restoration Act, which says some laws must be narrowly tailored to serve a compelling government interest if they affect individuals’ religious freedoms.

In Texas, a ban on abortion at all points of a pregnancy is scheduled to take effect Thursday. It has narrow exceptions for saving the life of the unborn child or woman, preventing a serious health condition from being aggravated or caused by the pregnancy, or removing an ectopic pregnancy.

Texas clinics have already stopped offering nearly all types of abortion because of uncertainty over whether the state’s 1925 ban can be enforced. The state also has a ban on abortions after embryonic cardiac activity can be detected, which is generally about six weeks into a pregnancy and often before a woman realizes she’s pregnant.