Times Square
Times SquareiStock

New York City prosecutors said on Wednesday that the machete-wielding man who allegedly attacked police officers near Times Square on New Year's Eve was motivated by Islamist extremism, AFP reported.

Trevor Bickford, 19, traveled to New York "to kill people and carry out Jihad," the Manhattan District Attorney's office told a state court.

Assistant DA Lucy Nicholas told the hearing that Bickford "specifically traveled" to New York via Boston with the intention of murdering government employees.

He is accused of attacking three officers shortly after 10:00 p.m. just outside the Times Square security zone where tens of thousands had gathered to celebrate the New Year.

Bickford allegedly hit two officers on the head, without causing life-threatening injury, before another officer used his service weapon to wound him in the shoulder.

Following his arrest, Bickford told detectives that he shouted "Allahu Akbar" before the attack, according to the prosecutors' complaint.

"I walked up and hit him over the head with a kukri. I charged another officer but dropped the knife and I tried to get the police officer's gun but couldn't," Bickford told police, according to AFP.

Nicholas said Bickford also stated that "all government officials" were a target for him "as they cannot be proper Muslims because the United States government supports Israel."

A senior New York City Police Department official told ABC News on Tuesday that Bickford was linked to Islamist extremism, adding, "He knew what he was doing. He knew why he was doing it and he thought he would die in the attack. He is not representing, you know, the Islamic religion but rather, you know, a very, very small percentage of people that get radicalized."

Bickford, who was formally arrested on Monday, faces charges of attempted murder of a police officer.