An Afghan family of five who traveled to the United States on special visas and were detained by immigration officials at the Los Angeles airport were released from custody, according to the US government and the family's attorneys. The mother, father and their three young sons, including a baby, arrived at the airport on Thursday for a connecting flight to Washington state, where they planned to resettle. Instead, US immigration officials detained them and split them up. They planned to send the mother and children to a detention center in Texas, but lawyers intervened over the weekend and got a federal judge to quash the transfer. Homeland Security officials haven't said why the family was held, while immigrant advocates asserted in a court petition that there was "absolutely no justification whatsoever." Government officials said in a federal court hearing on Monday that the family was given back their passports and visas and will be interviewed April 5 in Seattle to determine if they are eligible to use those visas to remain in the United States. Lawyers said the family never should have been subjected to such treatment after going through the more than yearlong process to obtain special immigrant visas, which are given to foreigners who work for the US military in their countries, often risking their lives. The father of the family worked different jobs for the US military in Afghanistan for more than a decade and was assaulted and shot during his time there, said attorney Rob Blume. "It is a victory in a battle that shouldn't have been fought," Blume said after the hearing. "The government swung and missed on this issue, and they just got it wrong." US District Judge Josephine Staton said she will retain jurisdiction of the case and that the government cannot detain or remove the family from the US without providing 72 hours' notice to their attorneys. "I'm just trying to prevent further injury," she said. Blume said the family's reunion Monday after being released was emotional. After being stopped at Los Angeles International Airport, the father was held at a detention center while his wife and young sons — one who is 8 months old — were initially held at separate detention center and later a hotel, attorneys said. "They've been through amazing trauma and traumatic circumstances over the last couple days," Blume said. "The separation was really a challenge for the entire family so you can imagine the relief when not only they're out of custody, but just being together again was so important." He declined to say whether they would stay in the Los Angeles area overnight or head to Washington right away. He said their identities would remain protected, citing potential danger to them because of the father's work for the US government.