CLEVELAND (AP) — A North Carolina man arrested Thursday on accusations that he tried to recruit people to join the Islamic State group had communicated with one of two men shot dead by a police officer in Garland, Texas, during an attack at an event where the Prophet Muhammad was being depicted in cartoons, the FBI said.

Erick Jamal Hendricks, 35, was arrested Thursday morning in Charlotte, North Carolina, on a charge filed in Cleveland of providing material support to a terrorist group. A federal magistrate in Charlotte ordered that Hendricks be detained and assigned a federal public defender, who did not return telephone messages.

An FBI affidavit details online communications between Hendricks and an undercover FBI agent posing as an Islamic State recruit who witnessed the attack at the suburban Dallas civic center in May 2015.

Two Phoenix men wearing body armor and carrying rifles drove to the center, exited a vehicle and began shooting at the entrance. An off-duty police officer providing security for the event fatally shot both men before they could get inside. An unarmed security guard was shot in the ankle.

The Islamic State group claimed responsibility for the attack and referred to the two Phoenix men, Elton Simpson and Nadir Hamid Soofi, as “brothers.” Shortly before the attack, the 31-year-old Simpson posted on his Twitter account: “May Allah accept us as mujahideen,” or holy warriors.

Simpson and Hendricks had communicated before the attack, the FBI said Thursday.

Hendricks also communicated with the undercover FBI agent in Garland, asking questions about security and how many people were there, the affidavit said. Hendricks told the agent that if he saw the organizer of the event that he should “make his voice heard against her,” investigators wrote.

It appears that charges were filed in Cleveland because of Hendricks’ communication with Amir Said Abdul Rahman Al-Ghazi, who was arrested in June 2015 in suburban Cleveland trying to buy an AK-47 rifle from an undercover FBI agent. Authorities said Al-Ghazi had pledged his allegiance to the Islamic State and expressed an interest in conducting attacks in the U.S.

Earlier this year, Al-Ghazi pleaded guilty to providing material support to a terrorist organization and, according to the affidavit, has been cooperating with authorities.

Al-Ghazi told authorities that Hendricks said he needed people to join the cause and wanted “brothers” to meet and train together, the affidavit said. The undercover FBI agent confirmed in the affidavit that his communications with Hendricks were similar to Al-Ghazi’s.

Hendricks told the undercover agent that he slept with his AK-47 and kept it by the front door, investigators said. He directed the agent to download a manual titled “GBS for the Ghuraba in the U.S.” that discussed law enforcement surveillance and communication protocols for those planning to stage attacks, the affidavit said.

Hendricks met with a paid informant and a second unidentified person in Baltimore in March 2015, the affidavit said. Hendricks directed them to remove cellphone batteries to make themselves less traceable, suggested he was going to go off the grid at property he owned in Alabama, and told them to prepare for an eventual violent confrontation with police, the affidavit said.

In April 2015, Hendricks told the undercover agent that he was in communication with Islamic State leaders who wanted followers to form groups in the U.S., the affidavit said.

Hendricks and an ex-wife, whom he divorced in 2009, attended another meeting in Baltimore with a paid informant the day before the May 3, 2015, attack in Texas, the affidavit said. Hendricks told the informant that future targets would include the organizer of the Muhammad cartoon event and members of the military whose information had been obtained in a computer hack.

Hendricks lived in the Columbia, South Carolina, area for about a year starting last summer and recently moved to the Charlotte area. It wasn’t immediately clear if Hendricks had a job in either place.

The woman who answered the door at an apartment in an east Columbia neighborhood said she didn’t know Hendricks, and a manager for the complex said she had no records for him. A woman named Tyrinda Hendricks leased the apartment, but no other records were available because the complex had changed management companies.

There was no answer Thursday at a number listed for Tyrinda Hendricks, who public records list as living in Charlotte.

___

Associated Press reporters Meg Kinnard and Seanna Adcox in Columbia, South Carolina, contributed to this report.