A federal immigration judge denied bail Friday to a 23-year-old engineering student from Tampa who has been charged by the U.S. government for engaging in terrorism.

The defendant, Youssef Megahed, has already been acquitted by a federal jury of related charges. But now, he faces essentially the same charges again in an immigration court, where if he is found guilty he faces deportation back to his native Egypt.

The undergraduate from the University of South Florida was arrested in 2007 in South Carolina with a companion, another USF student from Egypt named Ahmed Mohamed, driving a car that allegedly had explosives in the trunk. Mr. Megahed's companion explained the lengths of PVC pipe and chemical compounds were simply home-made fireworks that Mr. Mohamed planned to detonate for fun during a vacation. Mr. Mohamed later agreed to plead guilty to a federal charge of providing material support to terrorism — and submit to a 15-year sentence — while six charges of transporting explosives were dropped.

Mr. Megahed decided to fight those charges in court and was acquitted April 3 on four criminal counts stemming from the arrest. He had already served nine months in jail before making bail prior to the opening of his trial in March in Tampa.

But three days after the acquittal, Mr. Megahed was arrested a second time by federal agents at a local Wal-Mart store where he was shopping with his father. Mr. Megahed was charged under the Immigration and Naturalization Act as someone a U.S. official "knows, or has reason to believe, is engaged in or is likely to engage" in terrorist activity. He was also designated for deportation to Egypt, the country he emigrated from in 1998, when he was 12 years old.

Mr. Megahed was arrested by Immigration and Customs Enforcement special agents for immigration violations, "which differ from the allegations on his criminal case," although they derive from the criminal charges presented at his trial, said Nicole Navas, spokeswoman for ICE. If he is found guilty, he faces removal from the U.S., though he would have "the opportunity to bring his case before an immigration judge," she said.

Under current law, a noncitizen doesn't enjoy protection from double jeopardy says Mr. Megahed's attorney, Charles Kuck of Atlanta, at least not in immigration proceedings, where rules on evidence are different. "They obviously can't convict my client of criminal charges," Mr. Kuck said. "So they've gone for a venue where there is a lower burden of proof." Mr. Megahed couldn't be reached to comment.

At Mr. Megahed's April trial, the government entered as evidence a home computer, which prosecutors said showed that someone in the Megahed family had accessed sites that demonstrated how to make explosives. That failed to persuade the jury, however. "Are you ready to convict based on someone's Internet history? I'm not," said Gary Meringer, the foreman of the Tampa jury who acquitted Mr. Megahed in April. Mr. Meringer and three other jurors have issued a statement protesting the second arrest.