HILLSIDE, Ill. — The investigation started months ago, when the FBI noticed an email message: A man in the Chicago suburbs was using an account to distribute chatter about violent jihad and the killing of Americans.

Two undercover agents reached out and began to talk to him online. In May, they introduced him to another agent who claimed to be a terrorist living in New York.

The operation ended Friday night, an affidavit describing it says, when the man was arrested and accused of trying to detonate what he believed was a car bomb outside of a Chicago bar. Prosecutors said an undercover agent gave Adel Daoud, a U.S. citizen from the Chicago suburb of Hillside, a phony car bomb and watched him press the trigger.

The U.S. Attorney’s Office in Chicago, which announced the arrest Saturday, said the device was harmless and the public was never at risk. Daoud, 18, is due to make an appearance in federal court today morning on charges of attempting to use a weapon of mass destruction and attempting to damage and destroy a building with an explosive.

“We don’t even know anything. We don’t know that much. We know as little as you do,” a woman who answered the phone at his home and identified herself as his sister, Hiba, said Saturday. “They’re just accusations. ... We’d like to be left alone.”

Daoud’s father, Ahmed Daoud, declined to comment on Sunday.

“We don’t know anything about it,” he said when reached by phone.

The FBI often uses similar tactics in counterterrorism investigations, deploying undercover agents to engage suspects in talk of terror plots and then provide fake explosive devices.