An NYPD officer was saved by his protective vest Wednesday morning, after he was shot during a “violent” altercation with a naked man who was later shot and killed by police, officials said.

Eight armed officers from the 32nd Precinct responded at around 1:51 a.m. to a residential building in Harlem, where a 29-year-old male was reported to be “harassing” a female and “banging on doors and breaking glass” inside the building, Police Commissioner James O’Neill said during a news conference.

NEW YORK MAN ROBBED AT GUNPOINT DURING HAIRCUT, VIDEO SHOWS

Once inside the building, officers began to search the second floor — which is when one officer, who has yet to be identified, located the man in question, who was naked and armed with a 9-millimeter semiautomatic handgun.

O’Neill said the two got into a “violent” struggle. The officer called out for help and several other officers began to fire at the suspect.

At some point, the officer was shot in the chest, but the bullet did not penetrate his protective vest, O’Neill said. The suspect was struck several times and later pronounced dead at Harlem Hospital.

Authorities would not say if the officer was struck by the suspect or by friendly fire. He also suffered several injuries to his face after being punched during the altercation.

New York City Mayor Bill de Blasio commended the officer involved for his “bravery and strength.”

“He’s shaken but he’ll be OK,” de Blasio said.

O’Neill said the officer joined the force in 2012. He sustained non-life threatening injuries and is recovering at St. Luke's hospital.

CLICK HERE TO GET THE FOX NEWS APP

“Today we are reminded that no call is ever routine,” he continued.

Police did not identify the suspect but said he had a history of domestic dispute calls against him.