WASHINGTON — A federal appeals court is blocking for now an abortion sought by a pregnant 17-year-old immigrant being held in a Texas facility, ruling Friday that the government should be given time to try to release her so she can obtain the abortion outside of its custody.

A three-judge panel of the U.S. Court of Appeals for the District of Columbia issued its ruling a few hours after hearing arguments from lawyers for the Trump administration and the teenager. The court ruled 2-1 that the government should have until Oct. 31 to release the girl 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 chooses. If she isn’t released, the case can go back to court.

The teenager, whose name and country of origin have been withheld because she’s a minor, is 15 weeks pregnant.