A federal judge says a Virginia man must remain in jail until he's tried on a charge of trying to aid a terrorist group.

Magistrate Judge Lawrence R. Leonard ruled Wednesday that 26-year-old Lionel Williams poses too much of a danger.

Williams allegedly swore allegiance to the Islamic State group in Iraq on Facebook and gave $250 to undercover FBI agents pretending to buy weapons. Williams also allegedly owned an AK-47 assault rifle and wanted to commit a local "martyrdom operation" before his December arrest.

Williams' public defenders told the judge that he could live with his uncle. Members of his mosque were also prepared to vouch for him.

Federal public defender Keith Kimball argued that Williams was "entrapped" by the FBI.