A Miami immigration judge has signed an order to release an Egyptian man acquitted earlier this year of terrorism-related charges.

An agreement between immigration officials and Youssef Megahed's attorney on Friday comes after Immigration Judge Kenneth Hurewitz threw out his deportation case earlier in the day.

Immigration and Customs Enforcement agents arrested Megahed days after a jury found him not guilty on federal explosives charges. He and a fellow University of South Florida student in 2007 had homemade model rocket parts in the trunk of their car while traveling near a military base in rural South Carolina. Authorities said the materials looked like pipe bombs.

Megahed was expected to be released later Friday afternoon.