A 10-year-old girl with cerebral palsy has been released from immigration custody in Texas, her lawyers said Friday, 11 days after the Border Patrol stopped the ambulance she was riding in on her way to emergency gallbladder surgery.

The girl, Rosa Maria Hernandez, had been held in a facility for migrant children since last week as she recovered from surgery, not quite aware that her case was inflaming the national debate over illegal immigration, that a phalanx of lawyers was suing over her detention or that figures including members of Congress and Lin-Manuel Miranda, the creator of the musical “Hamilton,” were calling for her release.

Those working on her behalf appeared to win a partial victory on Friday afternoon, when she left the facility in San Antonio about 4:30 p.m. and was taken back to her family in Laredo, though she still faces the possibility of deportation.

“We’re just thrilled — it’s such a relief,” said one of her lawyers, Michael Tan, a staff attorney at the American Civil Liberties Union. “It’s actually quite overwhelming. This was the first time in her life she was separated from her family.”