MIAMI — A veteran of both the Army and the Navy who served with distinction in Iraq and at Guantánamo Bay has spent the last month in federal lockup here because the government wants to deport him.

Not only did he lie on a passport application, prosecutors say, but he was never even a citizen.

But a lawyer for the man, Elisha L. Dawkins, 26, has a different story, one that begins with Mr. Dawkins’s arrival here from the Bahamas as an infant. He was raised to believe he was a citizen, his lawyer contends, something the state and federal authorities did not challenge during his seven years in the military.

It is unclear why Mr. Dawkins was indicted in March, five years after receiving his passport and when he was still in the Navy.

“The military believes he’s an American citizen,” the lawyer, Clark Mervis, told Judge Cecilia M. Altonaga of Federal District Court here last week, noting that Mr. Dawkins had “secret” security clearance when he served in Guantánamo.