An undocumented immigrant teen in federal custody will face further delays in getting an abortion after a federal appeals court ruling Friday.

The 17-year-old girl is an unaccompanied minor from Central America who’s been detained at a South Texas shelter operated under the federal Office of Refugee Resettlement since September. The court said the government has until Oct. 31 to help the teen find a sponsor in the U.S. who could take custody, and then she could get the procedure. She is already about 15 weeks along, and the delay could push her closer to the 20-week limit on abortions in Texas.

“This is judicial punting at its worst, and on the back of a 17-year-old girl,” said Susan Hays, the legal director of Jane’s Due Process, who worked on the case in Texas.

The teen, known as “Jane Doe” in court papers, arrived in the U.S. and sought an abortion in early September. Because she is a minor and didn’t have her parents’ permission, under Texas state law she first had to ask a judge to approve the procedure. The judge agreed, but then the refugee office stepped in, refusing to let Doe out of custody to get the procedure and even taking her to a crisis pregnancy center to discourage her, Doe’s lawyers say. She sued and a federal district judge sided with her, but the government appealed.

She was allowed to receive mandatory pre-abortion counseling on Thursday, but the appeals court stayed the procedure until it could hear arguments on Friday.

Lawyers representing the Department of Health and Human Services, which has custody of Doe, said agency policy prohibits taking “any action that facilitates” an abortion, such as scheduling appointments or providing transportation, for teens in its care without the written approval of Scott Lloyd, the head of the refugee office. (Lloyd was appointed by Trump in March and is a longtime anti-abortion activist.)

Doe got a guardian to represent her and the funds to pay for the procedure. Doe’s lawyers said that by refusing to let her leave their facility for abortion care, the government was forcing her to carry an unwanted pregnancy to term.

Catherine Dorsey, a Justice Department attorney, argued the government was not blocking Doe’s pursuit of abortion because she had two other options: Return to her home country and obtain an abortion there, or find a sponsor family in the U.S. so that she could leave ORR custody and then terminate the pregnancy. The court agreed, as long as the process happens quickly, and told HHS it has 10 days to find Doe a sponsor. (A sponsor for her immigration case, generally a family member, would be different from the guardian she was appointed in state court.)