SANTA ANA (Reuters) - A family from Afghanistan detained on their arrival in Los Angeles last week despite holding special visas granted for the father’s service to the U.S. government in that country has been released, their attorneys said Monday.

FILE PHOTO: A U.S. Customs and Border Protection arm patch and badge is seen at Los Angeles International Airport, California February 20, 2014. REUTERS/Kevork Djansezian/File Photo

Lawyers for the family of five, who have not been publicly identified, said that it was still not clear to them why the father, mother and their three sons were taken into custody at Los Angeles International Airport on Thursday, interrogated and held for some 40 hours.

But attorney Robert Blume portrayed the detention as a mistake by U.S. immigration authorities, saying: “The government swung and missed on this one. They just got it wrong.”

The family’s detention came at a time of increased concern among immigrant rights advocates about tougher scrutiny of visitors as part of U.S. President Donald Trump’s crackdown on immigration on national security grounds.

All five members of the family were released on Monday before an emergency hearing sought by their lawyers in U.S. District Court in Santa Ana, California.

During that hearing attorneys for the U.S. Department of Justice did not offer a reason for the family’s detention but said the visa they held did not preclude further vetting by immigration agents if warranted.

All five family members, including the couple’s three young sons, were ordered to appear at a second hearing scheduled for April 5.

According to defense lawyers, the family members were granted so-called Special Immigrant Visas and the right to live in the United States in return for the father’s work for a decade at a U.S. military base in Afghanistan.

Blume said the man worked at the base as an interpreter and heavy machine operator, where he was “physically assaulted, shot at and verbally assaulted” by members of the Taliban.

Workers on the base were routinely photographed by the Taliban, putting their lives at risk, Blume added.

The family arrived in the United States on Thursday and was almost immediately taken into custody by CBP agents at the Los Angeles airport, according to defense court filings.

The mother was held in downtown Los Angeles with her children, while the father was in a maximum-security detention facility in Orange County.

The family’s lawyers said the government intended to transfer the mother and children to Texas, but they persuaded a U.S. district court judge on Saturday night to intervene and stop the move.

Attorneys for the family said they intended to settle in the Seattle area.