A New York City police officer shot and injured a man who lunged at cops with a metal pipe during an incident Friday night, police said. 

Police responded at around 10:35 p.m. to a disturbance regarding a 45-year-old man who was "acting erratically" inside his Staten Island apartment. 

The officers managed to bring the man outside to an ambulance, but the man took off as he received treatment and returned to his apartment, NYPD Deputy Chief Charles McEvoy told reporters. 

The man picked up a 2-and-a-half-foot metal pipe, which he swung at pursuing officers. One of the officers shot the man, striking him in the torso. 

NYPD OFFICER ACCUSED OF ASSAULTING MAN FOR ALLEGED RACIAL SLUR

The officers told him to drop the pipe but he refused, the New York Post reported.

EMS workers took the man to Staten Island University North Hospital and is he recovering. Both officers were taken to the same hospital for medical evaluation. 

Police collected the pipe as evidence. 

A neighbor, who only gave her name as Sharon, told the Post that the man had threatened her earlier that day. He had harassed her as she was crossing the street, telling her to "give it back," she said.

SECOND DC FIREFIGHTER HAS CAR STOLEN IN ONE WEEK, THIS TIME IN ARMED CARJACKING

"Then he goes, ‘I want it back. I know you took it. If you don’t give it back to me, you’re going to see what’s going to happen,'" Sharon said.

She told the Post she was the one to call the police after she saw him screaming as he walked up and down the block. 

CLICK HERE TO GET THE FOX NEWS APP

She said cops have responded to previous calls involving this resident over the last two years.