Rosa Maria Hernandez was taken into US Customs and Border Protection custody October 24 after her ambulance was stopped at a Border Patrol checkpoint.
Border Patrol agents determined that Rosa Maria was undocumented and followed her and a cousin accompanying her in the ambulance to the hospital, where the girl underwent surgery. The agents remained at the hospital until she was discharged into their custody, Gonzalez said at the time.
It is unclear whether the child's release means she will be able to avoid deportation, said US Rep. Joaquin Castro, a Texas Democrat.
"While this is welcome news, Rosa Maria's future remains uncertain," the lawmaker said. "The Trump administration has not made clear whether (it) will proceed with deportation proceedings against her. I continue to call for Rosa Maria's case to be administratively closed."
The American Civil Liberties Union had sued for the girl's release.
"Rosa Maria is finally free. We're thrilled that she can go home to heal surrounded by her family's love and support," ACLU attorney Michael Tan said. "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."
The family and its supporters characterized the girl's apprehension as cruel and unnecessary, while immigration officials said the procedures were routine enforcement of immigration laws.
Customs and Border Protection runs checkpoints along major thoroughfares leading away from the border in the Southwest, where travelers and vehicles are checked for legal authorization to enter the United States. The ambulance was traveling from Laredo, Texas, to Corpus Christi.
In a statement after Rosa Maria was detained, Customs and Border Protection said it was committed to enforcing the law.
"Due to the juvenile's medical condition, Border Patrol agents escorted her and her cousin to a Corpus Christi hospital where she could receive appropriate medical care. Per the immigration laws of the United States, once medically cleared she will be processed accordingly. The Mexican Consulate has been advised of the situation by Laredo Sector Border Patrol," the agency said.
Immigration advocates said the case shows the harmful extent of President Donald Trump's hard line on immigration policies.
Rosa Maria came to the United States from Mexicowhen she was 3 months old. She was diagnosed with cerebral palsy and has the mental capacity of a child half her age, according to her mother, Felipa de la Cruz.
The child was taken to a shelter run by the Office of Refugee Resettlement as is customary with undocumented, unaccompanied minors. The office falls under the US Department of Health and Human Services.
De la Cruz was able to video chat with her daughter in the children's home and said in October that the child didn't understand what was happening.
"I told her she was only there because she was recovering, and when she was recovered that she could come with me," she said two days after Rosa Maria was detained. "I start to think about her, and I want to start crying, and I become desperate."
The Department of Health and Human Services said previously it "does not identify individual (unaccompanied alien children) and will not comment on specific cases."
CNN reached out for comment Saturday but did not receive an immediate response.
Read more: www.cnn.com/2017/11/03/politics/undocumented-child-federal-custody/index.html