Federal prosecutors have abandoned their pursuit of a second trial against a Somali man accused of aiding high seas pirates. Now facing deportation, Ali Mohamed Ali plans to seek asylum, his lawyer said.

A jury acquitted Ali of the most serious charge against him—aiding piracy—in November. Prosecutors asked the court to dismiss the remaining charges on Jan. 18 after concluding that double jeopardy barred a retrial.

Ali’s lawyer, Matthew Peed of Clinton Brook & Peed, blamed “overzealous prosecutors” for bringing the charges in the first place.

“The government managed to inflict a substantial punishment on an innocent man in the form of nearly three years of pretrial detention—an unconscionable result in a country devoted to the rule of law,” Peed said in an email.

Although Ali was released from the D.C. Jail over the weekend, Peed said in a phone interview Tuesday that his client’s legal troubles are not over. Immediately after Ali’s release, immigration officials took him to a jail in Stafford, Va., to face deportation proceedings, the defense lawyer said. Peed said Ali intends to seek asylum.

Ali’s defense “required him to disclose how he worked against pirates,” Peed said. “If he’s deported, his life is going to be in danger.”

Ali was charged with helping Somali pirates negotiate a ransom after the pirates seized a ship near the Horn of Africa in late 2008. Shortly after the acquittal in November, prosecutors said they intended to retry Ali on two lesser charges concerning the taking of hostages.

In the Jan. 18 filing, however, Assistant U.S. Attorney Brenda Johnson wrote that lawyers for the government subsequently decided they were barred by double jeopardy from pursuing a retrial. Peed, in a motion to dismiss the case filed earlier this month, argued the government couldn’t retry Ali because the elements of the piracy charge he was acquitted of were related to the remaining charges.

A spokesman for the U.S. attorney’s office, William Miller, said in a statement that “our decision to end the prosecution of Mr. Ali is the result of the great respect that we have for the rule of law and the role of the jury in the criminal justice process.”

Miller said prosecutors stood by their decision to bring charges against Ali. The prosecution was “justified by the evidence presented at trial of his role in piracy and hostage-taking,” he said, but prosecutors recognized “that in our system it is jurors who must find the defendant guilty beyond a reasonable doubt to hold him accountable.”

Peed said prosecutors should never have brought the case. He said Ali provided the U.S. government with “counter-piracy intelligence” and “worked to promote stability and development in Somaliland, where he served as the director-general of education.”

“In an apparent turf battle,” Peed said, “overzealous prosecutors truncated these efforts by filing sealed charges, while FBI investigators, eager for a high-profile arrest, lured Mr. Ali to the U.S. by shamelessly posing as donors interested in promoting education for the children of Somalia.”

Ali’s imprisonment since his arrest in 2011 has been a significant point of contention. U.S. District Judge Ellen Segal Huvelle twice ordered Ali freed as he awaited trial, rejecting the government’s claims that he posed a flight risk. The U.S. Court of Appeals for the D.C. Circuit reversed Huvelle both times.

Peed said he hoped the dismissal of the case “brings attention to the plight of other pretrial detainees, for whom the presumption of innocence and the right to a speedy trial are too often dismissed in the face of hyperbolic accusations by the government.”

Contact Zoe Tillman at ztillman@alm.com. On Twitter: @zoetillman