Federal authorities have arrested a Michigan man they say is an ISIS supporter who wanted to carry out an attack on a 6,000-member Detroit church.

Khalil Abu-Rayyan, 21, of Dearborn Heights, allegedly had guns and a large knife and told an undercover FBI agent that he “tried to shoot up a church one day.”

“I bought a bunch of bullets. I practiced reloading and unloading,” he said in an online conversation, the FBI said.

Investigators did not specify which church Abu-Rayyan allegedly was eyeing, but said it has a capacity of 6,000 members, according to a criminal complaint unsealed Thursday in U.S. District Court.

The FBI had been monitoring Abu-Rayyan for months because of his “increasingly violent threats” about committing acts of terror and martyrdom against churchgoers and police officers on behalf of ISIS.

In addition to the alleged online conversations with the undercover agent, Abu-Rayyan purportedly used Twitter to express solidarity with the terror group.

Abu-Rayyan claimed it would have been “easy” to fire shots on the church, the complaint said. But according to authorities, he said his plan was foiled when Abu-Rayyan’s father discovered his gun, ammunition, and a mask he was going to wear before he could carry out the attack.

“Honestly I regret not doing it. If I can’t do jihad in the Middle East, I would do my jihad over here,” he allegedly said.

He also had armed himself with a knife and told the undercover agent, “It is my dream to behead someone,” authorities said.

Abu-Rayyan does not face any terror charges at this point, and is being held due to gun and drug charges stemming from an October 2015 incident in which he was pulled over for speeding with a pistol, sleeping pills, and marijuana, reportedNBC affiliate WDIV. Terror charges could be added later.

Abu-Rayyan is scheduled to appear in court Monday afternoon for a detention hearing.

Details of the alleged plot come the same week as an announcement from Twitter that the social network has shut down more than 125,000 accountsrelated to violent extremism.