A former Florida professor once accused of being a leading Palestinian terrorist was released from custody for the first time in more than five years.

Sami Al-Arian was being held by immigration officials as he awaited trial on charges of refusing to testify before a grand jury about a cluster of Muslim organizations in northern Virginia.

A federal judge on several occasions has expressed skepticism about the government's contempt charges, and last week ordered immigration authorities to explain by Tuesday afternoon why they were continuing to hold Al-Arian. He was released hours before the judge's deadline.

Al-Arian will be on home detention at his daughter's residence in Virginia while he awaits trial.

"We are obviously relieved and delighted," said Al-Arian's lawyer, Jonathan Turley, who wouldn't not make Al-Arian available for comment. Turley did say the release would allow Al-Arian to see his son off to college and spend the Muslim holy month of Ramadan with his family.

Federal prosecutors strongly opposed Al-Arian's release, but wouldn't comment Tuesday.

Al-Arian, who once taught computer science at the University of South Florida, has been in federal custody since February 2003, when federal prosecutors charged him with being a leader of the Palestinian Islamic Jihad.

A jury acquitted him on some charges in 2005 and were deadlocked on others. He eventually struck a plea bargain and admitted to lesser charges of conspiring to aid the PIJ by helping a family member with links to the group get immigration benefits and by lying to a reporter about another person's links to the PIJ.

He was sentenced to nearly five years in prison.

While serving that sentence, federal prosecutors in Virginia sought his testimony for a grand jury investigation. Al-Arian refused to testify despite immunity, and prosecutors earlier this year filed criminal contempt charges.

Al-Arian finished the sentence, and Turley argued that immigration authorities had no basis to detain Al-Arian and should either deport him to Egypt or release him pending the trial.

U.S. District Judge Leonie Brinkema last month postponed the trial after saying the government had filed charges prematurely. She also questioned whether the contempt charges violate the terms of Al-Arian's plea agreement, which bars the Justice Department from standing in the way of Al-Arian's deportation after he served his sentence.