David Baril, 30, faces seven counts of felony assault and criminal possession of a weapon, the NYPD said.
Baril, who police said suffers from schizophrenia and paranoia, was shot multiple times on a bustling midtown Manhattan street Wednesday.
He's in critical but stable condition at a hospital, officials said. Baril was struck three or four times in the right arm, torso and head area, NYPD Chief of Manhattan Detectives William Aubry said.
Police were on the lookout for him after he allegedly assaulted at least four people with a hammer Monday.
Aubry said two police officers spotted the suspected attacker near Penn Station on Wednesday morning. He was wearing a mask.
When officers approached him, the man turned around abruptly and began to swing the claw end of a metal hammer toward a female officer, Aubry said. The officer backtracked and attempted to radio help before falling to the ground. Her partner fired four times, striking the suspect twice.
Police Commissioner William Bratton described as heroic the actions of Officer Geraldo Casaigne, 36, the 12-year veteran who shot the suspect.
"He quite possibly saved his partner's life," the commissioner said.
The other officer, Lauren O'Rourke, a 27-year-old on the job since 2009, was struck with the hammer. She sustained abrasions and lacerations to her head and back, police said.
Casaigne was treated for ringing in his ears. Both officers have been released.
"We believe Officer O'Rourke is extremely lucky her partner was able to stop this attack when he did," the commissioner said.
At a news conference, police surveillance video of the attack and the shooting was shown to the media.
"These officers had no chance to call for assistance," Bratton said. "The whole incident took three seconds start to finish."
Suspect has history of mental illness
Police had used facial recognition technology to help identity the suspect from a photo snapped of him entering a subway station after one of Monday's attacks, Aubry said. Baril's photo was distributed to officers at roll call.
Baril has a history of schizophrenia and paranoia, Aubry said. Earlier this year, he voluntarily left a mental health facility, officials said.
"From what we're told, when he doesn't take his medication the condition becomes worse," Aubry said.
Baril had eight prior arrests on charges ranging from attempted assault to theft. He also had an outstanding warrant in connection with an assault on a worker at a fast-food restaurant.
Aubry said police found a social media post in Baril's name with a drawing of a hammer dripping with blood.
In the attacks Monday, Baril allegedly shouted profanities at a man near Herald Square before striking him in the head with a hammer. A few hours later, a woman in Manhattan was struck in the head with a hammer by a man yelling profanities.
The third victim was a 28-year-old woman who was sitting on a park bench in Union Square when a man removed a hammer from a bag and struck her in the head, a police statement said. She was taken to a hospital in stable condition.
About 10 minutes later, a 33-year-old woman walking a few blocks from the park suffered a scalp injury after being hit in the back of the head with a hammer, authorities said. She was taken to Lenox Hill Hospital in stable condition.