LOS ANGELES – The ACLU filed a federal lawsuit Tuesday demanding the release of a 10-year-old undocumented girl who was detained at a hospital by Border Patrol agents last week following a surgery.

The lawsuit was filed in federal court in San Antonio after federal immigration authorities failed to meet the ACLU’s deadline to release Rosa Maria Hernandez by 3 p.m. EDT on Tuesday.

The lawsuit alleges the Department of Health and Human Services’ Office of Refugee Resettlement (ORR) is holding Rosa Maria Hernandez in violation of her statutory and constitutional rights. The complaint also named US Customs and Border Protection (CBP) and the Department of Homeland Security (DHS).

“It is unconscionable to target a little girl in a children’s hospital,” said Michael Tan, a staff attorney with the ACLU’s Immigrants’ Rights Project. “Hospitals are considered sensitive locations under Homeland Security’s own policy, and the Border Patrol should not be arresting people there – especially children. The government’s actions are unlawful, cruel, and threaten to keep parents with sick children from seeking care.”

Rick Pauza, a spokesperson for CBP said the agency doesn't comment on pending litigation.

"However, lack of comment should not be construed as agreement or stipulation with any of the allegations," Pauza said. "In DHS’s homeland security mission, our trained law enforcement professionals adhere to the Department’s mission, uphold our laws while continuing to provide our nation with safety and security."

Rosa Maria was being transported from Laredo, Texas, to Corpus Christi last Tuesday via ambulance for gallbladder surgery when she passed through an immigration checkpoint, said her mother, Felipa De La Cruz.

Border Patrol agents allowed Rosa Maria, who has cerebral palsy, to go through the checkpoint with her cousin, a US citizen who was accompanying her, but followed the ambulance to Driscoll Children’s Hospital.

Border Patrol agents stood outside the girl’s hospital room the entire time she was there, De La Cruz said. Rosa Maria has lived in Laredo, on the border with Mexico, since she was three months old.

“It never crossed my mind that they would detain her. I thought the letter we had from a social worker would be enough,” De La Cruz told BuzzFeed News. “I feel so hopeless.”

The checkpoint she crossed is located miles from the border. BuzzFeed News has reported previously that Border Patrol checkpoints make undocumented immigrants feel trapped because they can’t cross them without risking being stopped, arrested, and deported. Some immigrants avoid crucial medical care because of the checkpoints.

The family's Los Angeles-based attorney, Alex Galvez, said that after the hospital released Rosa Maria, she was taken into custody and transferred to a San Antonio shelter for kids for three weeks.

“What this administration wants to do is create fear in the immigrant community. They want them to know that if you’re going go get treatment there’s no safe haven,” Galvez told BuzzFeed News. “There’s no reason immigration should’ve gone to this extreme to detain a 10-year-old at a hospital.”

Felipa De La Cruz

Once Rosa Maria is released, she will have to go before an immigration judge to stop her deportation, but for now there is no imminent threat she’ll be sent to Mexico, Galvez said.

In a statement, CBP spokesperson Rob Kise said agents encountered Rosa Maria and her cousin at the Freer Border Patrol Checkpoint on Highway 59, east of Laredo.

“Per the immigration laws of the United States, once medically cleared, she will be processed accordingly,” Kise said. “The Mexican Consulate has been advised of the situation.”

Galvez said the family also has to wait for the ORR to conduct a home study of Rosa Maria's residence.

He anticipates filing an asylum bid for Rosa Maria because of her cerebral palsy and the discrimination she would face in Mexico if she's deported.

“It’s the Wild West now if you’re undocumented. You’re exposed, and no hospital, church, or school is a safe haven,” Galvez said. “Nobody should have to be afraid of getting medical care because they fear being detained and deported.”

Her detention stems from federal authorities considering her an unaccompanied child because she was undocumented and traveling without her parent or guardian. The agency said they were required to take the “unaccompanied child” into custody by the William Wilberforce Trafficking Victims Protection Reauthorization Act of 2008.

“The law specifically defines who is a parent or legal guardian and there is no discretion with regard to the law whether or not the agents should enforce the law,” CBP said.

The ACLU’s lawsuit said Rosa Maria’s mother, through her social worker, arranged for her to be transferred to Driscoll Children’s Hospital through a transport service for children with special needs. Because De La Cruz is undocumented and couldn’t pass through the checkpoint without risking being deported herself she provided a signed notarized letter allowing Rosa Maria to travel with her 34-year-old cousin.

The arrest drew the ire of Rep. Joaquin Castro, who said on Twitter that CBP's detention of Rosa Maria was a misuse of resources.

US Customs and Border Protection lists hospitals, schools, and churches as “sensitive locations” that agents should go to only after careful consideration. The policy considers national security dangers, terrorism, and public safety threats circumstances that would require an agent to enter these locations.

In a statement CBP said the encounter initially took place at a checkpoint and not a hospital.

"It should be stressed that the encounter took place at a checkpoint and the actions taken were in accordance with the law and carried out as humanely as possible,” CBP said.

Rep. Zoe Lofgren, a California Democrat, and Rep. John Conyers, a Democrat from Michigan, sent a letter to Elaine Duke, acting Homeland Security secretary, on Thursday saying Rosa Maria’s detention was another example of the Trump administration failing to follow the agency’s sensitive location guidelines.

“In this case, this vulnerable child presented no risk of terrorism, danger to the community, nor to the public safety,” the letter said. “On the contrary, DHS’s decision to detain a 10-year-old child with cerebral palsy who just received emergency surgery only risks the child’s life and her well-being. It increases her risk of post-operative infection and medical complications.”

The letter also cited concerns that Rosa Maria’s case would instill community-wide fear and deter immigrants from seeking medical care for themselves or their children.

“We are concerned that the detention of this 10-year-old child is a result of an unjust, inhumane immigration enforcement policy that has shown no mercy, not even for sick, disabled children,” Lofgren and Conyers wrote.