A 10-year-old girl with cerebral palsy has been detained by federal immigration authorities in Texas after she passed through a Border Patrol checkpoint on her way to a hospital to undergo emergency gall bladder surgery.

The girl, Rosamaria Hernandez, who was brought over the border illegally to live in Laredo, Tex., when she was three months old, was being transferred from a medical center in Laredo to a hospital in Corpus Christi around 2 a.m. on Tuesday when Border Patrol agents stopped the ambulance she was riding in, her family said. The agents allowed her to continue to Driscoll Children's Hospital, the family said, but followed the ambulance the rest of the way there, then waited outside her room until she was released from the hospital.

By Wednesday evening, according to family members and advocates involved in her case, immigration agents had taken her to a facility in San Antonio where migrant children who arrive alone in the United States from Central America are usually held, even though her parents, who both lack legal status, live 150 miles away in Laredo.

Her placement there highlighted the unusual circumstances of her case: The federal government maintains detention centers for adult immigrants it plans to deport, facilities for families who arrive at the border together and shelters for children who come by themselves, known as unaccompanied minors. But it is rare, if not unheard-of, for a child already living in the United States to be arrested — particularly one with a serious medical condition.