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: Woman Shot In Hand In Broad Daylight In Irving Park

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: Member Of Illinois House Speaker Welch's Staff Tests Positive For COVID-19 In Springfield

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: Bomb Squad Called In After Live Grenade Is Found In South Austin

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