By Timothy Mclaughlin

CHICAGO (Reuters) - A would-be Islamic State recruit who worked in a Chicago-area hardware store was sentenced on Friday to more than three years in prison for seeking to join the militant group, federal prosecutors said.

In exchange for a more lenient sentence than he might otherwise have faced if tried and convicted, Mohammed Hamzah Khan, 21, pleaded guilty last year to a charge of attempting to provide material support, namely himself, to a terrorist organization.

Khan's lawyer said at the time of the plea that his client had been brainwashed by online propaganda.

In addition to a 40-month federal prison term, Khan will serve 20 years of supervised release once freed from custody, U.S. District Judge John Tharp Jr ruled during the sentencing in a Chicago courtroom.

Khan must also undergo mental health treatment, attend violent-extremism counseling and comply with a computer-monitoring program, the Justice Department said in a statement.

Khan was 19 when arrested in October 2014 at Chicago's O'Hare International Airport as he was about to board a flight to the Middle East with his siblings, then 17 and 16 years old, according to the Justice Department. He has been detained in federal custody since then.

His two siblings were not charged.

Earlier this week, nine Somali-American men from Minnesota were sentenced for trying to join or assist Islamic State. The group, designated a terrorist organization by the United States, has seized swaths of territory in Iraq and Syria while exhorting sympathizers around the world to carry out shootings and bombings of civilians.

The U.S. government has sought to thwart Islamic State recruitment. Federal authorities estimate that 80 percent of Americans linked to activities supporting militant movements have radicalized themselves with information from the internet.

Khan lived in the Chicago suburb of Bolingbrook and used his income from a hardware store job to pay for his and his siblings' passports and tickets.

He left behind writings saying he was off to join Islamic State, prosecutors have said. His parents have said they were not aware of their children's' plans.

In a case similar to Khan's, a man arrested while trying to board an airline flight from Los Angeles to Turkey last year was sentenced in September to 30 years in prison after a federal court jury found him guilty of conspiracy and attempting to join Islamic State.

(Reporting by Timothy Mclaughlin in Chicago; Editing by Steve Gorman and Grant McCool)