WASHINGTON (Reuters) - A U.S. appeals court on Friday prevented an illegal immigrant teenager detained by the government from immediately obtaining an abortion, although it left open the possibility she could undergo the procedure within days.

The decision by a U.S. Court of Appeals for the District of Columbia Circuit panel gave the government until Oct. 31 to approve a sponsor, who could help the 17-year-old obtain the procedure without the government’s assistance.

If the U.S. Department of Health and Human Services (HHS) signed off on the sponsor, she “will be lawfully able, if she chooses, to obtain an abortion on her own,” the court said.

It said the requirement that a sponsor be found did not “unduly burden” the immigrant’s right to an abortion under Supreme Court precedent.

The panel was made up of two Republican-appointed judges and one Democratic appointee, Patricia Millett, who wrote the sole dissenting opinion.

“What reason does the federal government offer for taking over (her) decision completely and forcing her to continue an unwanted pregnancy that Texas law permits her to terminate? None that remotely qualifies under the Constitution, or that even makes sense,” Millett wrote.

The teen, from an unidentified country, is currently detained in Texas and 15 weeks pregnant. She entered the United States without any family in September and was immediately detained by the government and placed in a shelter.

A federal judge in Washington this week ruled the abortion procedure could go ahead. But the government obtained a temporary order blocking the decision until the appeals court ruled.

The appeals court said that if the teen could not find a sponsor, she could renew her legal claim.

She had sought and received a Texas court order to approve the abortion because she is under 18, and had scheduled a sonogram and consultation with a physician, as required by state law. The Office of Refugee Resettlement, an arm of the HHS, refused to let her leave the detention center to carry out those steps, however.

The Administration for Children and Families, a division of HHS, issued the following statement later on Friday: “For however much time we are given, the Office of Refugee Resettlement and HHS will protect the well-being of this minor and all children and their babies in our facilities, and we will defend human dignity for all in our care.”

The American Civil Liberties Union, which has taken up the case, said in a court filing that the Office of Refugee Resettlement revised its procedures in March to mandate that abortions for under-age detainees required office approval.

The policy change came weeks after the inauguration of U.S. President Donald Trump, a Republican who campaigned on promises to clamp down on illegal immigration and seek new restrictions on women’s access to abortions.

“Justice is delayed yet again for this courageous and persistent young woman,” said ACLU lawyer Brigitte Amiri in a statement. “She continues to be held hostage and prevented from getting an abortion because the Trump administration disagrees with her personal decision.”