A young undocumented immigrant's legal battle to end her pregnancy will move to a federal appeals court Friday, with lawyers for the Trump administration arguing that the government is not obligated to facilitate an abortion for someone in the country illegally.

Government lawyers are seeking to halt a judge's ruling Wednesday that ordered officials to allow the teen, who is being held in Texas after crossing the border illegally, to have the abortion this week "without delay."

She is in her 15th week of pregnancy. Texas bans most abortions after 20 weeks.

Federal officials say the 17-year-old, who entered this country in September, could solve the problem herself by voluntarily leaving or finding a sponsor in the United States to take custody of her. "The Administration stands ready to expedite her return to her home country," the White House said in a statement.

But the American Civil Liberties Union, which is representing the teenager, says she is entitled to have an abortion, which she would pay for, under the 1973 Supreme Court ruling in Roe v. Wade.

They say the teen, who is from Central America, was abused by her parents and cannot easily return home. And although she has relatives in the United States, she may not find a sponsor in time to terminate her pregnancy.

"It is not appropriate to use abortion as a bargaining chip," said Brigitte Amiri, her ACLU lawyer. "She shouldn't have to give up that right."

It remains unclear whether the teen could legally obtain an abortion in her home country. The ACLU has not released her nationality to preserve her privacy.

On Wednesday, U.S. District Judge Tanya Chutkan in Washington sided with the ACLU and ordered the government to swiftly allow the teenager, identified in court papers as Jane Doe, to meet with a doctor for counseling that the state requires at least 24 hours before an abortion. The meeting would clear the way for the teen to have the procedure Friday or Saturday, the judge ruled.

But the Justice Department appealed, and a three-judge panel of the U.S. Court of Appeals for the D.C. Circuit immediately stayed part of Chutkan's order. The panel said the temporary halt was intended to "give the court sufficient opportunity to consider the emergency motion for stay and should not be construed in any way as a ruling on the merits of that motion."

The judges — Karen LeCraft Henderson, Brett M. Kavanaugh and Patricia A. Millett — allowed the teenager to undergo the state-mandated counseling Thursday.

The ACLU said an abortion provider will be ready to perform the abortion Friday if the appeals court rules in the teen's favor.

The teenager is being held at a shelter near the Mexican border that is overseen by the U.S. Department of Health and Human Services, which is responsible for undocumented minors caught crossing the border without family.

She learned she was pregnant following a medical examination after she was taken into federal custody, her lawyer said. Federal officials denied her request to terminate the pregnancy on Sept. 27, citing the Trump administration's policy of "refusing to facilitate abortions."

Under the administration of President Barack Obama, the government did not pay for abortions except in the case of rape, incest or a threat to the woman's life. But officials did not block immigrants in U.S. custody from having abortions at their own expense.

The ACLU has asked the lower court judge to extend any protections offered to the 17-year-old to other unaccompanied, undocumented minors who are pregnant and in U.S. custody.

If the teenager does not obtain an abortion this week, her lawyers said, she may have to go to another health center hundreds of miles away because of scheduling problems and clinic hours. Texas law requires that the same doctor counsel a patient and perform the abortion.

The Supreme Court has ruled that the government cannot impose an "undue burden" on a woman's right to terminate her pregnancy in the early stages.

In its court filings, the Justice Department said the U.S. government has a "legitimate interest in promoting fetal life and childbirth over abortion."

"HHS does not impose any 'undue burden' on her ability to get an abortion merely by refusing to facilitate it," the government wrote. "Courts have recognized that the government may legitimately refuse to facilitate abortion without violating a woman's constitutional rights."

Attorneys general from nine states, including Texas, Missouri and Ohio, are backing the federal government, saying in a court filing that there is no "constitutional right to abortion on demand."

Texas Attorney General Ken Paxton wrote that the high court has never said that abortion rights extend to undocumented immigrants without "significant ties" to the United States.

"The district court's order effectively creates a right to abortion for anyone on Earth who entered the United States illegally, no matter how briefly," the attorneys general said.

The teen's lawyers say the government's position is a clear constitutional violation and that the teen should be allowed to be transported for an abortion — just as the government does for federal prison inmates seeking the procedure.

By "preventing her court-appointed representatives from transporting her to the clinic, the government has effectively barred her from obtaining an abortion," the ACLU said. "This they may not do."