A Tucson man charged with plotting a terrorist attack on a motor vehicle office in metro Phoenix will remain jailed until his trial because he poses a danger to the community, a judge ruled Wednesday.

Maricopa County Superior Court Judge Sam Myers said no conditions could be imposed on releasing Mahin Khan from jail that could ensure the public is protected.

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

They say Khan wanted to inspire an insurgency in the United States to carry out the sort of attacks that had occurred in Paris and Brussels and had online exchanges with a person believed to be a member of the Islamic State terrorist group.

According to authorities, Khan had expressed a desire to attack a Jewish community center in Tucson. Authorities also said they found a document in a search of his home that showed he wanted to attack a military recruiting center and an LA Fitness location.

Khan has pleaded not guilty to state charges of with terrorism, conspiracy to commit terrorism and conspiracy to commit misconduct involving weapons.

Outside of the courtroom, Khan's attorneys and two family members declined comment Wednesday on the allegations.

Khan was denied bail after his July 1 arrest because he was accused of terrorism, but he was still entitled to another hearing to examine whether there's proof to back up the charges before bond can be denied.

Prosecutor Blaine Gadow said the FBI and Khan's parents had taken steps in the past to steer him away from his radical viewpoint, but he kept making statements about wanting to attack targets.

Authorities say the FBI first approached Khan when he was 15 years old and that he later underwent 45 days of mental health treatment for a condition that wasn't specified in court.

An FBI agent had also testified that Khan, who was arrested just days after his 18th birthday, had expressed frustrations earlier about not being able to buy a gun until he was an adult. "He is 18 and capable of simply refusing his parents guidance and assistance in getting away from this way of thinking," Gadow said.

Defense attorney John Andrew Champagne argued that Khan should be released from jail and electronically monitored to ensure the public's safety.

Champagne said no weapons were found inside Khan's home during a search by investigators. He also pointed out the FBI's lead investigator couldn't say which state Motor Vehicle Division location in Mesa that Khan is accused of wanting to attack.

Authorities said Khan also had written emails to a suspected member of the Pakistan Taliban seeking weapons and instructions for a homemade explosive. It's not clear if Khan was corresponding with an actual member of the group, but court records show that the FBI examined the emails.

In the emails, Khan said he backed the Islamic State and was looking to carry out an attack. Court records show the person responded that he would have to pay for two rifles and a pistol he requested, so Khan said he wanted instructions for a bomb itself.

The FBI began investigating Khan after someone reported him for suspicious activity and agents were tracking him as he asked someone else on April 16 about targeting Mission Bay, California, and an Air Force recruitment center in Tucson, according to the probable cause statement filed into court records.

_______

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