A Rochester, New York man has been arrested and charged with planning a terrorist attack on New Year’s Eve, the FBI said. The suspect was said to be plotting to attack a restaurant with a machete, on behalf of Islamic State.

Emanuel Lutchman, 25, appeared before a federal court on Thursday, facing charges of providing material support to Islamic State (IS, formerly ISIS/ISIL). A convert to Islam, he has served five years in prison for robbery and has mental health issues, according to prosecutors.

Lutchman was convicted in 2006 of robbery in New York State. #rocpic.twitter.com/6tS57Tm3QC — News 8 - WROC-TV (@News_8) December 31, 2015

Lutchman was arres ted after he bought supplies for the planned attack at a Rochester Walmart on Tuesday. As hehad no money, an FBI informant paid for the machete, duct tape, knives, ammonia, latex gloves and ski masks, court documents said.

Another informant testified that Lutchman had communicated with an IS handler, expressing hatred of America – which he called “land of the kuffar" (unbelievers) – and a desire to travel to Syria to join the terror group. The handler reportedly asked Lutchman to prove his allegiance to the group by organizing an attack inside America, according to the criminal complaint.

Court papers say Rochester man charged with plotting #isil#terror attack lives in this duplex off Culver Rd. pic.twitter.com/LMiweluAtK — Rebecca Fath (@whec_rfath) December 31, 2015

"As part of Emanuel Lutchman's attempt to provide material support to ISIL, he planned to kill innocent civilians on New Year's Eve in the name of the terrorist organization," said Assistant Attorney General John Carlin, commenting on the arrest. "Thankfully, law enforcement was able to intervene and thwart Lutchman's deadly plans."

The document detailing the charges against Lutchman says that he planned the attack with two FBI informants, originally wanting to use pressure cooker bombs but deciding on knives instead after one of the informants backed out of the plot on the Bureau’s instructions.

“We gotta do this precise,” Lutchman told the informant, according to the complaint. “If we grab somebody, they can’t live.”

The charge carries a maximum penalty of 20 years in prison and a $250,000 fine.