The speculation about terrorism has inspired more than protests. In 2017, a Tennessee man, Robert Doggart, was sentenced to nearly 20 years in prison over a plot to recruit a militia and storm the enclave. In a phone call recorded as part of a federal wiretap, Mr. Doggart said, “I don’t want to have to kill children, but there’s always collateral damage.”

The most recent threat of violence came last week after investigators in Greece, outside Rochester, thwarted an apparent plan concocted by a group who, officials said, had stockpiled 23 firearms and three homemade bombs.

Three men — Vincent Vetromile, 19, Brian Colaneri, 20, and Andrew Crysel, 18 — were arrested and charged with criminal possession of a weapon and conspiracy, and a fourth person, whose identity was not released because he or she is a minor, was charged as an adolescent with the same offenses.

It is unclear how the individuals were connected, but three of them had been Boy Scouts. In the days before the plot was uncovered, at least one of them, Mr. Vetromile, shared far-right memes and conspiracy theories about border security and a government scheme to seize weapons. The authorities also said that the defendants had corresponded using Discord, a group chat app created for video gamers that became popular with far-right activists.

Mr. Vetromile and Mr. Colaneri remain in custody, according to jail records.

“Just imagine having to wake up and tell your children of such a plot, tell your children that their life was in danger,” said Rashid Clark, Islamberg’s mayor.

Much of the scrutiny directed at Islamberg centers on the community’s ties to Mr. Gilani, an elusive figure who became more widely known after the 2002 murder of The Wall Street Journal reporter Daniel Pearl in Pakistan. Mr. Pearl, who was reporting on a story about the so-called shoe bomber, Richard C. Reid, was seeking an interview with the sheikh when he was abducted. (The sheikh is not believed to have been involved in the plot, counterterrorism analysts said.)