The 14-year-old girl who had been detained by Immigration and Customs Enforcement in a Marlborough parking lot and then sent to a facility in New York reunited with her aunt Thursday afternoon, according to her attorney Andrew Lattarulo. After waiting for about an hour at the John F. Kennedy Federal Building in Boston, the girl’s aunt was relieved to see her niece safe and healthy. The teen was driven back to the state from New York by two female federal officials, who told the aunt they were trying to protect the teen from alleged gang members and the situation was a misunderstanding, Lattarulo said. Both the girl and her aunt felt relieved and happy to be back together, he said. But while the reunification was successful, the teen was given an immigration notice to appear, a document that indicates the government will attempt to deport her to her native Brazil.“They’re putting her in removal proceedings. It’s saying that she’s removable from the United States,” Lattarulo said in a phone interview Thursday. “That goes against what they said, that they were just trying to help her. Then, within a few hours, they gave her this [document] and sent her off.” The teen had entered the United States on a visa in 2019, according to court records. Her mother is deceased and her father is not involved in her life, according to Lattarulo, who said she was living with her older brothers, who are US citizens. She previously attended school in Brighton, though a Boston Public Schools spokesperson said she is not currently enrolled. The girl was detained by federal agents Tuesday afternoon in a Marlborough parking lot under questionable circumstances. She told her lawyer she was going to a Brazilian bakery with two friends when federal agents stopped their car and detained her. In a statement to the Globe Wednesday, Department of Homeland Security Deputy Assistant Secretary Lauren Bis said ICE had not arrested the girl, but rather “rescued her from suspected gang members.”ICE was conducting a “targeted operation” to arrest two suspected Primeiro Comando da Massachusetts gang members from Brazil who were in the country illegally, Bis said. She identified the men as Igor Jose Cordeiro Ferreira, 28, and Lucas Da Silva Senes De Almeida, 25, and said the vehicle used by the two men was connected to an alleged home invasion in Walpole earlier in March.After the girl was detained, Lattarulo petitioned the federal court in Boston for her release. He and US District Judge Leo T. Sorokin questioned why she was not turned over to state child welfare authorities, which is standard procedure. Lattarulo said the girl had no known criminal history.Sorokin ordered the girl be brought back to Massachusetts by Thursday afternoon. Moving forward, Lattarulo said, his goal is to ensure the girl can remain under her aunt’s custody, and he will handle those matters in a probate court. He will also fight the government’s attempt to deport her and will petition for special immigrant juvenile status, a pathway to legal residency for young people who have been abused, neglected, or abandoned by a parent. Giulia McDonnell Nieto del Rio of the Globe staff contributed to this report. Marcela Rodrigues can be reached at marcela.rodrigues@globe.com.