CHICAGO (AP) — A suburban Chicago man who attempted to join the Islamic State will spend the summer at a halfway house for getting on the internet without prior court permission.

Mohammed Hamzah Khan of Bolingbrook, who served three years in prison, was caught by the FBI using a smartphone to log onto dating sites.

READ MORE: Chicagoans React To President Biden' Plan To Tackle The City's Gun Probem

The 22-year-old Kahn, who is on 20-years of probation, appeared Wednesday before U.S. District Judge John Tharp. However, instead of sending Kahn to jail as requested by prosecutors, Tharp ordered him to a halfway house for the summer.

READ MORE: Minooka Community High School District 111 And Stanley Fabian Come To Agreement On Lawsuit

Mohammed Hamzah Khan (Credit: Facebook)

Tharp made clear he has little patience with Kahn, saying his going on the internet was strike two for him. Khan, who faced a maximum 15-year term, was sentenced to 40 months in 2016.

Defense attorney Thomas Durkin asked that Khan be placed in a halfway house so he could continue with his classes at the College of DuPage.

MORE NEWS: Tornado Victims Displaced Having Trouble Finding New Housing In Post Pandemic Era

(© Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)