In the last month, Mr. Thomas had searched online four times for the phrase “why did Hitler hate the Jews,” according to the complaint. It said he had also sought information on temples and recent anti-Semitic incidents in New York City, and had kept journals expressing anti-Semitic views — including references to Hitler and Nazis, as well as drawings of a Star of David and a swastika.

The police said that after the stabbings, Mr. Thomas drove to Manhattan, where he was pulled over and arrested by the authorities.

Mr. Thomas’s family and one of his lawyers told reporters that he had no history of anti-Semitism, but that he did suffer from mental illness, including schizophrenia. They said he claimed to hear voices that directed him to Monsey to retrieve or destroy a piece of property.

Mr. Thomas, of Greenwood Lake, N.Y., was ordered detained on the federal charges pending further proceedings. If convicted, he could face life in prison.

The reaction

New York’s Jewish community was already rattled by the shooting early this month at a kosher supermarket in Jersey City, N.J. The series of gunfights linked to that attack left six people dead, including two Hasidic Jews.

Then last week, New York City police officials, citing at least eight anti-Semitic incidents since Dec. 13, began stepping up patrols in Borough Park, Crown Heights and Williamsburg, all Brooklyn neighborhoods with large numbers of Jewish residents.

Saturday’s attack happened in Rockland County, just northwest of the city.

As New York City’s ultra-Orthodox population has grown, many Hasidic families have relocated in recent years to Rockland, which is now believed to have one of the largest populations of ultra-Orthodox Jews outside of Israel.