Updated

Advocates for a pregnant 17-year-old girl held in a Texas facility for immigrant children who have crossed the border alone are asking a federal judge to allow her to get an abortion, over the opposition of U.S. and state officials.

A federal magistrate judge in San Francisco has scheduled a hearing Wednesday on a request filed by the American Civil Liberties Union of Northern California, which accuses the U.S. Department of Health and Human Services of refusing to let the girl be taken for the procedure.

Rochelle Garza, a lawyer appointed to represent the girl's legal interests, told The Associated Press on Tuesday that the teen may be up to 14 weeks pregnant. Texas state law prohibits most abortions after 20 weeks.

Garza said the teen is from Central America but declined to give the girl's name or identify the specific country where she was from, citing the girl's privacy as a minor.

With her help, the girl obtained a judicial waiver under a Texas law requiring a minor seeking an abortion to get consent from a parent. But staff at the facility where she's being held refused to take her to her appointments with a doctor to seek an abortion, or let the attorney take her, even though private groups that support abortion rights have raised money for the procedure, Garza said.

Instead, she was taken to a crisis pregnancy center. Such centers encourage pregnant women not to have an abortion.

"I feel like they are trying to coerce me to carry my pregnancy to term," the girl said in a declaration filed in federal court last week.

The teen’s request for an abortion has been met with harsh denials by U.S. and state officials.

U.S. lawyers representing HHS argued that the ACLU's request for a temporary restraining order allowing an abortion to go forward was wrong on technical grounds, since the original lawsuit argued HHS was violating the First Amendment by allowing religious groups to allegedly refuse access to abortion. In this case, the 17-year-old is not being held in a facility with a religious affiliation, government lawyers said.

Texas Attorney General Ken Paxton went further in a separate filing Tuesday. Paxton, who is a strident opponent of abortion rights like most leaders in the nation's largest conservative state, argued that people in the United States illegally without some type of established ties to the country did not have a "constitutional right to an abortion on demand."

If the court rules in the girl's favor, "the ruling will create a right to abortion for anyone on earth who enters the U.S. illegally," Paxton said in a statement. "And with that right, countless others undoubtedly would follow. Texas must not become a sanctuary state for abortions."

It was not immediately known how long the girl would be held at the facility, or whether she would eventually be transferred.

The Associated Press contributed to this report.