A judge on Thursday granted a request for release from a suburban teenager accused of trying to join an al-Qaida-affiliated group.



Abdella Tounisi will await trial outside jail under home confinement and electronic monitoring, the judge said. Tounisi's father must be his third-party custodian.



After announcing his surprise ruling, the otherwise soft-spoken U.S. magistrate judge leaned forward on his bench Thursday and raised his voice, telling the teenager he should take the allegations seriously.



"This is no game, Mr. Tounisi. OK?" Judge Daniel Martin told him.



The slight, short Tounisi stood before the judge in orange jail garb and slippers, flanked by U.S. marshals. Some 30 friends and relatives sat on spectator benches; several cried after the judge ruled.

After ruling, the judge stayed his own order for 24 hours to give prosecutors a chance to appeal, which they announced later Friday they would do. A hearing in the matter was set for Friday.



Prosecutor William Ridgway had argued that Tounisi posed a threat to the community, saying he sought to hook up with the al-Qaida-linked group in Syria even after his friend Daoud's arrest.



"One would think that would be a wake-up call," Ridgway said about the arrest. "But it didn't deter him."



Tounisi persisted even as family and friends warned him not to get involved with extremists, Ridgway said. He quoted a friend as saying about Tounisi in a wiretap, "He will not die a martyr. He will die like road kill."



The prosecutor said Tounisi also is a flight risk, noting how he had managed to secure a U.S. passport on short notice and to scrape together money for a plane ticket.



"He's very resourceful," Ridgway told the judge.



But Tounisi's attorney, Molly Armour, said Tounisi came from a caring home and had no prior criminal record. She also said a terrorist-related charge shouldn't automatically deny release.



"The word 'terrorism' is a word that tends to taint everything," she told the court.



She also gestured to the back of the courtroom, where dozens of members of his community sat, assuring the judge they would also watch over Tounisi and see that he stays out of trouble.



"They are committed to being part of his life," she said. "That offers a backstop to the family."



Judge Martin said repeatedly that his decision to grant Tounisi release was a close call. He told Tounisi's father, Ahmad Tounisi, that a landline must be installed in the Aurora family home before his son could be released — to comply with home confinement and electronic monitoring.



The judge told Tounisi's father that he will be obliged to contact authorities immediately if his son takes "one step out of the house." The elder Tounisi said he understood and would comply.



Federal authorities said Tounisi is a threat and should remain behind bars, but the 18-year-old's family has said they believe he is innocent.



Tounisi faces one count of attempting to provide material support to a foreign terrorist organization, a felony. He is accused of planning to join an al-Qaida group in Syria and was living with his family in Aurora when he was arrested last month at O'Hare International Airport.



According to the FBI, Tounisi was discovered through a sham website claiming to connect users with extremist groups. Prosecutors also allege he is friends with Adel Daoud, charged with trying to detonate what he thought was a bomb outside a Chicago bar last year.



Speaking with Tounisi's father after the arrest, he said he believes his son was looking for an escape and wouldn't hurt anyone.



Tounisi has yet to enter a plea. He faces up to 15 years in prison if convicted.



The Associated Press' Michael Tarm contributed to this report.