Rosa Maria Hernandez, 10, was detained by federal immigration agents in Texas after she passed through a Border Patrol checkpoint on her way to a hospital to undergo surgery. (Courtesy Agustina Arroyo)

Lawyers for an undocumented 10-year-old girl who was detained in Texas after undergoing surgery demanded her immediate release on Tuesday in a lawsuit filed against the Trump administration in federal court.

Rosa Maria Hernandez, who has cerebral palsy, has been held at a federally funded shelter in San Antonio since leaving a Corpus Christi hospital last week after gallbladder surgery.

She had planned to return to her parents and siblings in the U.S. border city of Laredo, 150 miles away.

Border officials have said they detained Rosa Maria, who has lived in the United States since she was three months old, because she was undocumented and traveling to the hospital in an ambulance without her parents.

But her lawyer called that position “indefensible,” saying the government is well aware that the girl’s parents, two sisters, and a grandfather, who is a legal resident, are anxiously awaiting her return.

“She’s been ripped away from the only home she knows and the mother who cares for her best,” said Andre Segura, legal director for the American Civil Liberties Union of Texas, which filed the lawsuit on behalf of the girl and her mother, Felipa de la Cruz, in federal court in San Antonio.

It was the second time in a month that the ACLU has sued the federal government over the fate of a minor being held by the Department of Health and Human Services, which oversees the care of unaccompanied immigrant children through the Office of Refugee Resettlement.

The organization represented a pregnant 17-year-old who had been blocked from obtaining an abortion while in a government-funded shelter. The D.C. appeals court last week ordered the government to allow her to have the procedure.

The case involving Rosa Maria began Oct. 24, when she left her home in Laredo around 2 a.m. in an ambulance for the scheduled surgery. Her mother, who is also undocumented, was concerned about a border checkpoint located on the way to the hospital and did not accompany her daughter.

Instead, de la Cruz signed a notarized letter authorizing a cousin, 34-year-old Aurora Cantu, to accompany the girl, according to the ACLU.

U.S. Border Patrol agents stopped the vehicle at an interior checkpoint in Freer, Tex. They were told about her impending surgery and, after a 30-minute delay, followed the ambulance to Driscoll Children’s Hospital in Corpus Christi, the lawsuit says. The complaint alleges that agents told Cantu that Rosa Maria would be detained after the surgery unless she voluntarily left the country. Federal officials say she is a citizen of Mexico.

U.S. Customs and Border Protection said federal law required them to take Rosa Maria into custody because she was not with a parent or legal guardian. They also notified the local Mexican consulate.

“For the welfare of the child, she was escorted by Border Patrol agents to the hospital to undergo surgery and remained with the unaccompanied child until such time as she could be transferred to the Health and Human Services Office of Refugees and Resettlement to re-unite the child with her parents,” the agency, which is part of the Department of Homeland Security, said in a statement.

But the ACLU said officials were not legally obligated to take Rosa Maria into custody because she has parents in Laredo. They said the forced separation of Rosa Maria from her family violates her legal and constitutional rights, and has “inflicted serious psychological and emotional injury” on her entire family.

She is being held at the BCFS Health and Human Services shelter in San Antonio. Her father recently visited her, Segura said, but her mother has not seen her and is distraught. They said the girl has never before been separated from the family.

It was not immediately clear why Rosa Maria was not released to her father when he visited the shelter.

A spokeswoman for Health and Human Services said the agency does not comment on individual cases, but aims to “ensure the care and safety” of minors, including their “safe and timely release” to qualified parents and guardians.

Some children are released to sponsors, who must apply for custody and provide supporting documentation. The government verifies their relationship and conducts background checks and in some cases, home studies. The process can take weeks or months.

Rosa Maria’s parents brought her to the United States when the girl was a baby to seek medical care. Doctors said she’d remain in a vegetative state. But with home care and frequent therapy, the lawsuit says, she has grown into a “joyful young girl with a constant smile on her face.”

She attends school, plays with her sisters, speaks English and considers herself an American, according the complaint.

But the lawsuit also said Rosa Maria has the cognitive capacity of a six-year-old. She “doesn’t fully understand why she is away from her mother,” Segura said.

The lawsuit said the government-funded shelter is an inappropriate place to care for Rosa Maria, noting that the hospital discharge papers said it was in the girl’s “best interest” to be discharged to a family member who is “familiar with her medical and psychological needs.”