The lawyer for a Virginia man accused of joining and then quitting the Islamic State group says his client is no longer a danger to the U.S., but a federal judge disagrees and has denied bail.

At a detention hearing Tuesday in Alexandria, defense lawyer John Zwerling emphasized the apparent change in heart from 26-year-old Mohamad Khweis of Alexandria. Prosecutors brought terrorism charges against Khweis, saying he traveled to Syria and Iraq to join the Islamic State group. Khweis said he became disillusioned after a few months and surrendered to Kurdish forces.

Zwerling argued unsuccessfully that Khweis should be free pending trial.

Judge Ivan Davis sided with prosecutors who argued that Khweis represents a continuing threat. Davis said anyone who knowingly joined an organization that decapitates and burns its captives alive poses a danger.