A federal appeals court in Washington ruled Friday to temporarily block a pregnant teenager who entered the United States illegally from having the abortion she is seeking.

The three-judge panel of the U.S. Court of Appeals for the District of Columbia gave the government until Oct. 31 to release the 17-year-old into the custody of a so-called sponsor, such as an adult relative in the United States. If that happens, she could obtain an abortion. If she isn't released, the case can go back to court.

The teen, who goes by "Jane Doe" in court documents and whose country of origin has been withheld, crossed into the U.S. in September and learned she was pregnant while in custody. A lower court ruled earlier this week that she should be able to obtain an abortion Friday or Saturday, but the government appealed.

The teen is currently being held at a Texas detention facility. Court documents indicate that she is 15 weeks pregnant. Texas law forbids abortions later than 20 weeks into a pregnancy.

Federal health officials said in a statement Friday after the ruling that for "however much time" they are given they "will protect the well-being of this minor and all children and their babies" in their facilities.

Susan Hays, legal director of the Texas group Jane's Due Process, which works with pregnant minors seeking an abortion and had offered to help pay for the teen's abortion, said the court appeared to be "punting" the final decision on whether the teenager would be entitled to an abortion.

Brigitte Amiri, the ACLU lawyer who represented the teen in court, said in a statement after the ruling that the group is "investigating all avenues to get justice for her."

"Justice is delayed yet again for this courageous and persistent young woman. She continues to be held hostage and prevented from getting an abortion because the Trump administration disagrees with her personal decision," Amiri said. "Our client and women across this country should be able to access a safe, legal abortion without federal officials stepping in to interfere."

During arguments at the appeals court Friday morning, Amiri told the judges that all the government needs to do is "get out of the way."

But Trump administration lawyer Catherine Dorsey told the judges that the U.S. Department of Health and Human Services, which is responsible for sheltering children who illegally enter the country unaccompanied by a parent, has a policy of "refusing to facilitate" abortions and that releasing the teen would require arranging a transfer of custody and follow-up care.

The possibility of the teen being released to a sponsor was raised at the court hearing.

Judge Brett Kavanaugh, who was appointed by George W. Bush, suggested that releasing the teen to a sponsor would seem to be the best option. That, he said, would get the teen out of the facility where she is being held, allow her to obtain an abortion and leave the government out of it. Brigitte Amiri, a lawyer for the ACLU representing the girl, said a sponsor hadn't yet been found and that the process could take months. At least one potential sponsor has fallen through.

In a two-page order, Kavanaugh and Judge Karen Henderson, both of whom were appointed by Republican presidents, joined to say that if a sponsor is found by Oct. 31 and the teen released, the government agrees she "will be lawfully able, if she chooses, to obtain an abortion on her own pursuant to the relevant state law."

The third judge on the panel, Judge Patricia Millett, who was appointed by a Democrat, President Barack Obama, would have allowed the girl to obtain an abortion as the lower court ruled earlier this week. Millett wrote that the girl "has already been forced by the government to continue an unwanted pregnancy for almost four weeks, and now, as a result of this order, must continue to carry that pregnancy for multiple more weeks."

Fox News' Jake Gibson and the Associated Press contributed to this report.