Patricia Millett Patricia Millett.

In a 2-1 ruling Friday, the U.S. Court of Appeals for the D.C. Circuit refused to require the government to allow a detained undocumented 17-year-old to get an abortion.

In a two-page order, the court gave the Department of Health & Human Services until 5 p.m. on Oct. 31 to find a sponsor for the girl, at which point she would be free to leave the government’s custody and get an abortion. The girl, known only as Jane Doe, is being held in a federally funded shelter in Texas.

The court also vacated sections of the lower court’s temporary restraining order, issued Wednesday, that forced the government to allow Doe to be transported to an abortion facility. The appeals court remanded the case to the district court and said that should HHS not be able to secure a sponsor, the order said the lower court could re-enter its temporary restraining order, and the government could then appeal again.

The ruling came just hours after the appeals court held oral argument on the case Friday morning. Judges Brett Kavanaugh and Karen Henderson, appointed by Presidents George W. Bush and Ronald Reagan, respectively, were in the majority. Judge Patricia Millett, appointed by President Barack Obama, dissented.

Millett wrote a scathing dissent, in which she said the government’s position was “wrong and unconstitutional.”

“The government’s refusal to release [Doe] from custody is not just a substantial obstacle; it is a full-on, unqualified denial of and flat prohibition on J.D.’s right to make her own reproductive choice.”

Millett wrote that contrary to its argument, the government is not facilitating the abortion. Doe will be transported to the procedure by her guardian, expenses will be paid by her guardian and attorneys, and paperwork and medical care will be provided by a government contractor.

Millett also took issue with the government admitting Doe would be able to get an abortion in ICE custody if she were a few months older.

“The government identifies no case that says the government has a right to flatly prohibit an abortion—to override the woman’s choice—by virtue of keeping her in custody,” Millett wrote. “And to be clear, it is a custody from which the government would willingly release her to attend doctor appointments if she were to continue her pregnancy.”

The order also said Henderson would file a statement concurring within five days.

The government argued in the case that because the minor had the option of either returning to her home country or securing a sponsor, HHS’ refusal to allow her to leave the shelter to get an abortion was not imposing an undue burden. In the order, the judges said they agreed, “so long as the process of securing a sponsor to whom the minor is released occurs expeditiously.”

Time is of the essence in the case. Doe is in her 15th week of pregnancy. By Oct. 31, she will be in her 17th. Texas bars abortion after 20 weeks, and requires that the same doctor do both the procedure itself as well as pre-procedure counseling 24 hours before. The American Civil Liberties Union is concerned that because of the availability of doctors willing to perform the procedure, Doe may be forced to travel hundreds of miles to get the procedure if she can get it in time at all.

The ACLU brought the case on behalf of Doe, arguing that by refusing to allow her to leave the shelter, the government was effectively violating her constitutional right to an abortion. During oral arguments Friday, Justice Department lawyer Catherine Dorsey said the government was not taking a position in the case about whether undocumented immigrants have a right to an abortion, but that even if they did, that right was not being violated.

“We note that the government has assumed, for purposes of this case, that J.D. —an unlawful immigrant who apparently was detained shortly after unlawfully crossing the border into the United States—possesses a constitutional right to obtain an abortion in the United States,” the order noted.