Ten-year-old Rosa Maria Fernandez has been released by ICE officials after the young illegal immigrant was detained at a border check point last week while en route to the hospital in an ambulance to undergo emergency gallbladder surgery.

The American Civil Liberties Union said the federal government had discharged the child, who suffers from cerebral palsy, on Friday after the organization had filed a lawsuit against the Trump administration in pursuit of her release.

Rosa Maria had been brought into the U.S. illegally when she was three months old.

“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.

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