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)

Federal officials on Friday released a 10-year-old girl with cerebral palsy who was detained in Texas Oct. 25 after undergoing surgery because she was an undocumented immigrant traveling without her parents.

Rosa Maria Hernandez was transported from a federally funded shelter in San Antonio, where she had been held for 10 days, to her family's home 150 miles south in the border city of Laredo. She was born in Mexico, but has lived in Texas since she was three months old.

"I am incredibly happy that she's going to be reunited with her mother and the rest of her family," said Andre Segura, legal director of the American Civil Liberties Union of Texas, which filed a lawsuit seeking her release this week. "The family is obviously very excited to have her back."

The girl's case sparked national outcry from members of Congress, physicians and lawyers who urged the government to let her go. Sen. Dianne Feinstein (D-Calif.) called on the Senate Judiciary Committee to hold a hearing and even celebrities got involved, such as Tony-award-winner Lin-Manuel Miranda, who tweeted #FreeRosa.

On Friday, as federal employees drove her home, advocates cheered the government's decision and called on the Trump administration to drop any plans it may still have to deport the girl.

Her lawyers said Rosa Maria has been served with a notice that she could face deportation but charges have not been officially filed in immigration court.

"This family has gone through enough," said Michael Tan, a staff attorney with the ACLU's Immigrants' Rights Project. "It is the most outrageous case I have ever worked on."

Rep. Joaquin Castro (D-Tex.) also urged the Trump administration to drop her case, saying, "The United States should not be a place where children seeking life-sustaining medical care are at risk of apprehension."

Immigration and Customs Enforcement, which handles the charges, did not immediately respond to a request for comment late Friday.

The U.S. Department of Health and Human Services also declined to comment. The agency oversees the Office of Refugee Resettlement, which cares for unaccompanied minors and arranges their release to parents or guardians.

The episode began in the early morning of Oct. 24, when Rosa Maria left her Laredo home in an ambulance to head to a scheduled gall bladder operation at a hospital in Corpus Christi.

Her mother, Felipa de la Cruz, who is also undocumented, did not accompany her daughter because she feared being detained at a Border Patrol checkpoint several miles inland. Instead, she signed documents authorizing a U.S. citizen cousin to travel with the child.

U.S. Customs and Border Protection officers screened the vehicle at the checkpoint and discovered that Rosa Maria was undocumented. They said federal law required them to take her into custody because she was undocumented and without her parents.

Border agents trailed her to the hospital, guarded her during the surgery and then took her into custody. The agents then turned her over to the Office of Refugee Resettlement.

While she was at the shelter, Tan said, the girl's parents told her she was in a hospital, to avoid frightening her with the prospect of deportation. She has the cognitive capacity of a 6-year-old child, and had never been away from her family before.

Still, during a visit with her father, Tan said, the girl burst into tears and pointed to the healing wound from her operation and asked why she couldn't go home.

"She's profoundly traumatized," Tan said.

Lawyers and advocates argued that the government should not have detained Rosa Maria because she had a family — parents and two sisters — in Laredo.

The case marked the second time in a month that the ACLU had sued the federal government over an undocumented minor in federal custody. Earlier, 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 ordered the government to let her have the procedure.