Khan was accused of wanting to inspire an insurgency in the U.S. to carry out the sort of attacks that occurred in Paris and Brussels and had online exchanges with a person believed to be a member of the Islamic State terror group.

Authorities said Khan had also expressed a desire to attack a Jewish community center in Tucson and that investigators found a document in a search of his home that showed he wanted to attack a military recruiting center and a fitness location.

Defense attorney Robert Ditsworth said Khan has struggled with mental health issues and shown poor impulse control but accepts responsibility for his actions.

Khan’s friends and family made emotional pleas for leniency, describing him as a lost and confused child. “He knows that the mistake he made was wrong,” said Bisma Khan, his cousin.

Prosecutor Blaine Gadow said Khan wasn’t being prosecuted for just his words but also for his actions in relaying bomb-making instructions to an undercover FBI employee.

“There has to be a consequence, a price to be paid,” Gadow said.

Prosecutors have said the FBI and Khan’s parents had taken steps in the past to steer Khan away from his radical viewpoint.

Authorities say the FBI first approached Khan when he was 15 and he later underwent 45 days of mental health treatment for a condition that hasn’t been publicly specified.

___

Follow Jacques Billeaud at twitter.com/jacquesbilleaud. His work can be found at http://bigstory.ap.org/content/jacques-billeaud.