An Afghan soldier seeking U.S. asylum who was arrested while trying to cross the Mexico border has been freed and reunited with his brother after spending months in immigration detention, his attorney said Wednesday.

Abdul Wasi Safi’s release from custody in a detention center in Eden, Texas, came after a judge dropped an immigration charge against him at the request of federal prosecutors.

Wasi Safi, an intelligence officer for the Afghan National Security Forces, fled Afghanistan following the withdrawal of U.S. forces in August 2021, fearing reprisals from the Taliban because he had provided U.S. forces with information on terrorists. In the summer of 2022, he began a treacherous journey from Brazil to the U.S.-Mexico border, where he was arrested in September near Eagle Pass, Texas. He had hoped to join his brother, who lives in Houston.

Prosecutors filed a motion asking a federal judge in Del Rio, Texas, to dismiss the immigration charge "in the interest of justice" and on Monday the judge granted that request.

Zachary Fertitta, one of his criminal defense attorneys, said Wednesday that Wasi Safi is receiving medical care at an undisclosed location but that he plans to speak at a news conference on Friday in Houston.

Fertitta said Wasi Safi and his brother "are overjoyed to be reunited."

AFGHAN SPECIAL FORCES COMMANDO SEEKING ASYLUM GETS CAUGHT IN BROKEN US IMMIGRATION SYSTEM

Jennifer Cervantes, one of Wasi Safi's immigration attorneys, said there was no reason to keep him in custody, especially given that the FBI has already spoken to him and found no problems.

"He’s certainly not a danger to the United States. He’s done a lot of good service for the United States," Cervantes said.

U.S. Rep. Sheila Jackson Lee, a Houston Democrat, belongs to a bipartisan group of lawmakers that has been working to free Wasi Safi. She said in a statement Tuesday night that she expects him to arrive in her hometown by Friday.

Photo of Afghan soldier

Sami-ullah Safi holds photographs of his brother, Abdul Wasi Safi, during an interview on Jan. 18, 2023, in Houston, Texas. Safi's brother was an intelligence officer with the Afghan National Security Forces, providing U.S. armed forces with information for operations against terrorists. Wasi Safi was arrested after crossing the Mexico border near Eagle Pass, Texas. He was charged with a federal misdemeanor related to wrongly entering the country and placed in a detention center. (AP Photo/David J. Phillip)

The Department of Homeland Security, which oversees Customs and Border Protection and ICE, has not responded to an email seeking comment Wednesday.

Sami-ullah Safi, Wasi Safi’s brother, was employed by the U.S. military for several years as a translator. Sami Safi said he is pleased the criminal case has been dropped but that he remains frustrated about how his sibling has been treated in light of his family's support for the U.S in Afghanistan.

"If we categorize my brother’s service, how many lives he has saved because of his service and how many lives I have saved because of my service being a combat translator?" Sami Safi said.

Wasi Safi’s case was first reported by The Texas Tribune.

WHAT IS THE AFGHAN ADJUSTMENT ACT AND HOW COULD IT HELP AMERICA'S FORGOTTEN ALLIES?

On his journey from Brazil to the U.S., Wasi Safi suffered serious injuries from beatings, including damaged front teeth and hearing loss in his right ear.

Fertitta said Wasi Safi's injuries were not sufficiently treated while he was detained but it's unclear how serious of a concern they have become.

"I’m going to have to wait to be advised by the medical personnel on that," Fertitta said.

The lawyers, lawmakers and military organizations that have been working to free Wasi Safi say his case highlights how America’s chaotic military withdrawal continues to harm Afghan citizens who helped the U.S. but were left behind.

Nearly 76,000 Afghans who worked with American soldiers since 2001 as translators, interpreters and partners arrived in the U.S. on military planes after the U.S. withdrawal from Afghanistan. But their immigration status remains unclear after Congress failed to pass a proposed law, the Afghan Adjustment Act, that would have solidified their legal residency status.

CLICK HERE TO GET THE FOX NEWS APP

Cervantes said Wasi Safi’s case is not unique and that other Afghans seeking asylum at the U.S.-Mexico border have also faced difficulty getting their cases properly reviewed. She said she hopes her work "sheds some light on that and (helps) these guys get what I think is the right thing to do, what I think is fair for them."