The Texas Supreme Court on Monday overturned a lower court order allowing an abortion for a pregnant woman whose fetus was diagnosed with a fatal condition, hours after her lawyers said she had decided to leave Texas for the procedure in the face of the state’s abortion bans.

The court ruled that the lower court made a mistake in ruling that the woman, Kate Cox, who is more than 20 weeks pregnant, was entitled to a medical exception.

In its seven-page ruling, the Supreme Court found that Ms. Cox’s doctor, Damla Karsan, “asked a court to pre-authorize the abortion yet she could not, or at least did not, attest to the court that Ms. Cox’s condition poses the risks the exception requires.” Texas’ overlapping bans allow for abortions only when a pregnancy seriously threatens the health or life of the woman.

“These laws reflect the policy choice that the Legislature has made, and the courts must respect that choice,” the court wrote.

The ruling, which applied only to Ms. Cox’s current pregnancy, suggested that the court would not be open to readings of the law that would expand the medical exception in Texas beyond all but the most serious cases. The fact that Ms. Cox decided to leave the state rather than wait for a ruling underscored the difficulty of seeking court permission for an abortion in the midst of a pregnancy.

Ms. Cox asked the lower court for approval after she learned that her fetus had a fatal condition, and after several trips to the emergency room. Her lawyers and her doctor argued that carrying the pregnancy to term risked her health and her future ability to have children.

The legal authorization she obtained from the lower court was put on hold when Ken Paxton, the state attorney general, appealed to the Texas Supreme Court. But uncertain of when a ruling would come, her lawyers said on Monday that she had decided to seek an abortion in a state where it is legal.

“Kate desperately wanted to be able to get care where she lives and recover at home surrounded by family,” Nancy Northup, the chief executive for the Center for Reproductive Rights, which was representing Ms. Cox in her case, said in a statement. “While Kate had the ability to leave the state, most people do not, and a situation like this could be a death sentence.”

The case was believed to be the first to seek a court-ordered exception since the U.S. Supreme Court overturned Roe v. Wade last year, clearing the way for Republican-controlled states like Texas to enact near-total bans on abortions.

It marked a new chapter in the legal history of abortion in the United States, with pregnant women now going to court seeking permission for their doctors to do what they determine to be medically necessary without fear of severe criminal or civil penalties. Legal challenges have emerged in several states where doctors said the bans were preventing abortions even in cases of serious pregnancy complications.

Last week, a Kentucky woman who was eight weeks pregnant filed suit seeking to overturn that state’s bans.

Ms. Cox’s case, filed last week, was unusual for being brought during her pregnancy. At the same time that the Texas Supreme Court was considering her case, it was also weighing an action brought by women and their doctors, represented by the Center for Reproductive Rights, seeking to clarify the limits of medical exceptions to the Texas abortion bans.

That case, Zurawski v. Texas, involves women who said they were forced to continue pregnancies, despite dangers to their health, because the vagueness of the state’s exemptions made doctors extremely cautious about when a medical condition was serious enough to allow for an abortion. Ms. Cox’s husband and Dr. Karsan, are also represented by the Center for Reproductive Rights.

In its decision on Monday, the Texas Supreme Court suggested a general standard that could be applied beyond Ms. Cox’s case.

“The exception does not mandate that a doctor in a true emergency await consultation with other doctors who may not be available,” the court wrote. “The exception is predicated on a doctor’s acting within the zone of reasonable medical judgment, which is what doctors do every day.”

A Texas judge gave Kate Cox, whose fetus had a fatal diagnosis, permission to get an abortion.Credit…Kate Cox, via Associated Press

Through September, Texas recorded only 34 abortion procedures performed in the state in 2023, according to state health statistics. In 2020, before the first of the state’s highly restrictive laws went into effect, there were more than 50,000.

A spokeswoman for Texas Right to Life, an anti-abortion group, lamented that, despite the court’s decision, Ms. Cox would be able to obtain an abortion elsewhere. “We mourn the decision to take Baby Cox’s life rather than give her every chance at life,” the spokeswoman, Kimberlyn Schwartz, said in a statement.

Lawyers for Mr. Paxton’s office argued in their appeal that Ms. Cox did not meet the criteria for a medical exception to the state’s overlapping abortion bans, which are among the strictest in the nation, and said she was seeking an “elective abortion.”

Ms. Cox’s fetus received a diagnosis of trisomy 18, a genetic abnormality that in all but rare cases results in miscarriage, stillbirth or an infant’s death within the first year after birth. Dr. Karsan, who is also a plaintiff in the Zurawski case, determined that an abortion would be the safest option for the mother’s health.

Ms. Cox, a mother of two young children who has said she would like a big family, has been to the emergency room four times during the course of her pregnancy for symptoms including discharge and cramping.

The lower court judge, Maya Guerra Gamble, a Democrat in the Travis County district court, agreed in her ruling that Ms. Cox could have the abortion under Texas law.

Dr. Karsan “believes in good faith, exercising her best medical judgment,” that an abortion was the medically recommended course of action, the judge wrote. The judge issued a temporary restraining order barring Mr. Paxton and others from enforcing the state bans against Dr. Karsan, Ms. Cox’s husband, and any medical staff members who assisted an abortion in her case.

Mr. Paxton objected, first sending letters to three Houston hospitals where Dr. Karsan can admit patients, saying that the judge’s order was only temporary and would not protect them from civil or criminal penalties if they allowed Ms. Cox’s procedure. Soon after, Mr. Paxton appealed the lower court’s order to the Texas Supreme Court, whose nine members are all Republicans.

In their brief, state lawyers argued that to allow abortions to be performed based on the standard of a “good faith” determination of a doctor that they are medically necessary “opens the floodgates to pregnant mothers procuring an abortion” through a willing doctor.

Under Texas law, a doctor convicted of performing an illegal abortion can face a prison term of up to 99 years and fines of at least $100,000.

Lawyers for Mr. Paxton’s office argued that the standard for determining what constitutes a serious threat was clear: a doctor’s “reasonable medical judgment” that a pregnancy posed such a risk; they said Ms. Cox did not meet that threshold.

The court agreed with the state, finding that the “good faith” standard had been applied by the lower court in error and that the correct standard, under the law, is a “reasonable medical judgment.” It asked the Texas Medical Board “to provide guidance in response to any confusion that currently prevails.”

“Judges do not have the authority to expand the statutory exception to reach abortions that do not fall within its text under the guise of interpreting it,” the Supreme Court found.

“Our ruling today does not block a lifesaving abortion in this very case if a physician determines that one is needed under the appropriate legal standard, using reasonable medical judgment,” the court added. “If Ms. Cox’s circumstances are, or have become, those that satisfy the statutory exception, no court order is needed.”