This article is more than
1 year oldTrevor Bickford - who was also charged with two counts of attempted assault - travelled to NYC by train from Maine before the attack, police said.
US media reported his family recently told the FBI they feared he was being radicalised by Islamist extremists.
Police Commissioner Keechant Sewell said the attack was "unprovoked".
The three officers - one of whom suffered a fractured skull after being struck by the machete - were all released from hospital on Sunday.
Mr Bickford is believed by investigators to have travelled to the city on 29 December after withdrawing thousands of dollars in cash from his bank account and purchasing the knife later used in the attack.
He allegedly launched his attack shortly before 22:00 local time on Saturday near an area that had been set up for New Year's Eve celebrations, Ms Sewell said.
During the attack he attempted to strike police over the head with his weapon, before one of the officers fired their weapon and hit him in the shoulder, officials said.
Mr Bickford remains in hospital under police custody because of the injuries sustained in the attack.
According to US media reports, his mother and aunt had reported him to the FBI over their fear that he had been radicalised by extreme Islamists.
CNN, citing law enforcement sources, reported that was interviewed by FBI agents in Maine in mid-December after he said he wanted to travel overseas and help fellow Muslims.
The network also reported that a backpack found at the scene contained a diary in which he expressed his desire to join the Afghan Taliban and believed he would die in the attack.
Ahead of New Year's Day, the NYPD had released intelligence reports suggesting that some terrorist groups were preparing for a potential attack.
"Throughout December, multiple pro-ISIS users disseminated extremist propaganda graphics broadly calling for attacks in advance of the New Year, advocating a wide range of low-tech tactics," the assessment report said.
Newer articles
<p>A US judge has ruled against Donald Trump getting his hush money conviction thrown out on immunity grounds.</p>