Ms. Cantu has said that border agents at the checkpoint asked for her and Rosa Maria’s papers and escorted them to their destination at Driscoll Children’s Hospital. There, they waited outside Rosa Maria’s room during her surgery, taking her into custody immediately upon discharge.

She was subsequently transferred to the Baptist Children’s Home Ministries in San Antonio, a center for unaccompanied minors — which Mr. Tan said never should have happened.

“If I send my kid to soccer practice with a neighbor, or to school on a school bus, the mere fact that I’m not with my kid does not mean that I relinquish my parental rights,” he said.

Under a 2002 law, the Office of Refugee Resettlement is authorized to take custody of children under 18 who have no parent or legal guardian either present or available in the country.

In an interview with The New York Times last week, Rosa Maria’s mother, Felipa de la Cruz, said she and her partner had risked coming to the United States for the chance to obtain life-changing health care for their daughter.

Mr. Tan said he was hopeful the case would go before the district court in San Antonio as early as this week.