Updated

A Tucson man charged with plotting a terrorist attack on a motor vehicle office in metro Phoenix also expressed to an undercover FBI employee that he wanted to target a Jewish community center in his hometown in a violent attack, a federal agent testified Tuesday at a court hearing.

Agent Benjamin Trentlage said Mahin Khan eventually focused on plans to attack a motor vehicle office in Mesa and instructed the undercover employee to start building homemade grenades.

The agent said the 18-year-old 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.

"He described the MVD (Motor Vehicle Department) as a soft target. He said it would have a lot of people and relatively low security," Trentlage said, adding Khan decided against attacking a motor vehicle office in Tucson because there was a sheriff's office located nearby.

The agent was the only person to testify Tuesday at a bond hearing for Khan, who has pleaded not guilty to state charges of with terrorism, conspiracy to commit terrorism and conspiracy to commit misconduct involving weapons.

Khan was denied bail after his July 1 arrest because he was accused of terrorism, but he is still entitled to another hearing to examine whether there's proof to back up the charges before bond can be denied. His bond hearing will continue on Wednesday, when Khan's lawyers will have a chance to question the FBI agent.

One of Khan's attorneys, Robert Ditsworth, tried unsuccessfully to get a judge to close the hearing to the public and pointed out the safety concerns faced by three of Khan's family members who sat in the courtroom gallery.  "This is a touchy subject," Ditsworth said.

Outside the courtroom, the defense lawyer and Khan's family members declined to comment on the allegations.

Trentlage said Khan revealed his desire to attack the Jewish community center in an October 2015 exchange with an undercover FBI employee. During the exchange, Khan referred to a 2015 attack on a reserve center in Chattanooga, Tennessee, that killed four Marines and a sailor. The agent also said Khan wanted to use pressure cookers to make homemade bombs, as had been done in the Boston Marathon bombings.

On the day of his arrest, Khan left a voicemail for an undercover FBI employee in which he expressed admiration for attack that killed 49 people and wounded 53 others at a gay nightclub in Orlando, Florida, Trentlage said.

It's unclear whether the undercover FBI employees in question were investigators or paid informants.

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.