A federal judge on Wednesday ordered top United States government officials to allow a pregnant 17-year-old immigrant to get an abortion — the first ruling in a case that could eventually grow to include hundreds of other undocumented minors who seek access to an abortion while in federal custody.

In issuing a temporary restraining order on Wednesday, the United States District Court judge, Tanya S. Chutkan, said the minor, who is in federal custody and is referred to in court documents as Jane Doe, was legally entitled to an abortion and would suffer increased health risks if not given transportation to an abortion facility and access to the procedure.

Late Wednesday, the federal government filed a motion asking the United States Court of Appeals to block the judge’s ruling pending an appeal. On Thursday, the ruling was stayed to give the court time to consider the motion.

According to a transcript of Wednesday’s court hearing, a lawyer for the federal government argued that because the minor had chosen to remain in the United States, she could “pursue relief through voluntary departure” from the country or choose not to get an abortion.