A 10-year-old girl with cerebral palsy who is in the U.S. without legal permission was discharged Friday by federal immigration authorities, after she had been detained last week following an emergency surgery.

The American Civil Liberties Union said the federal government had released Rosa Maria Fernandez on Friday, after the organization had filed a lawsuit against the Trump administration in pursuit of her release.

“Rosa Maria is finally free. We’re thrilled that she can go home to heal surrounded by her family's love and support,” Michael Tan, an attorney with the ACLU’s Immigrants’ Rights Project, said in a statement. “Despite our relief, Border Patrol’s decision to target a young girl at a children’s hospital remains unconscionable. No child should go through this trauma and we are working to make sure it doesn’t happen again.”

Border Patrol agents in Texas detained Hernandez as she passed through a Border Patrol checkpoint last week while in an ambulance for emergency gallbladder surgery, according to the New York Times.

The ACLU stated detaining Hernandez was illegal because she “needs this care, stability, routine and support” and noted she “is completely dependent on her mother.”

Hernandez was brought into the U.S. illegally when she was three months old.