Updated

A Tucson, Arizona, man accused of plotting a terrorist attack on a metro Phoenix motor vehicle office has agreed to a plea agreement.

Maricopa County Superior Court officials said Monday that Mahin Khan pleaded guilty to terrorism, conspiracy to commit terrorism and conspiracy to commit misconduct involving weapons.

The 18-year-old Khan is scheduled to be sentenced on Nov. 4.

Authorities say Khan is facing at least five years in prison.

Kahn was arrested in July, pleaded not guilty and was being held without bond until his trial.

Authorities say Khan wanted to attack a motor vehicle office in Mesa and allegedly instructed an undercover FBI employee to start building homemade grenades.

They say Khan had online exchanges with a person believed to be a member of the Islamic State terrorist group.