The suspect, Zale Thompson, who was shot dead by two other officers on Thursday afternoon on a street in the borough of Queens, had made anti-Western postings on social media and visited websites associated with several radical Islamic groups, police said at a news conference.
A search of computers seized from the home of Thompson's father in Queens, where the 32-year-old man lived, showed he also spent time reading online about beheadings, a recent intrusion at the White House and attacks in Canada.
"This was a terrorist attack," Commissioner William Bratton said.
Investigators were trying to determine whether Thompson, a black man who converted to Islam two years ago, had any connection to an area mosque. Police said the social media postings of the man described as an unemployed recluse were "anti-government, anti-Western, anti-white."
Still under investigation was the extent of planning involved in the attack, which appeared to be unprovoked and somewhat spontaneous, Bratton said.
"The fact that he was walking around with a hatchet in the backpack makes it clear this individual had some sense of preparation," Bratton said.
The attack on Thursday, which took place in a shopping district, unfolded in a matter of seconds, police said. A group of four police officers were posing for a freelance photographer when Thompson charged them, swinging the hatchet. One officer was struck in the arm and another in the head before the other two officers opened fire, killing Thompson.
A 29-year-old female bystander was struck in the lower back by a stray bullet and critically wounded.
Kenneth Healey, the 25-year-old officer hit in the head, remains in critical condition at Jamaica Hospital, Bratton said.
The officer struck in the arm, Joseph Meeker, 24, was treated at the hospital and released, he added.
Thompson, who was involuntarily discharged from the Navy in 2003 for undisclosed reasons, lived with his father at a home in Queens, but had stayed at his mother's residence the night before the incident, Bratton said.
Police detectives are still conducting interviews to piece together the details Thompson's past and what may have led him to become violent, the commissioner said.
Police already have some information about him, however. Thompson was arrested in southern California six times between 2002 and 2003, likely for domestic disputes, New York Chief of Detectives Robert Boyce said.
At age 16, in 1998, Thompson was the victim of an assault, he said.