A New York City police officer was shot in the left shoulder by his partner Tuesday night as the two were trying to make an arrest during a drug investigation and two suspects were taken into custody, police said.

The officers, a sergeant and a detective who were in plainclothes and conducting a narcotics investigation, had stopped a car in the Bushwick neighborhood of Brooklyn around 6:15 p.m., according to Benjamin Tucker, the first deputy commissioner of the New York Police Department. Tucker spoke at a news conference at Elmhurst Hospital in Queens, where the officer was taken.

The sergeant approached the driver's side of the car and the detective walked up to the passenger's side, reaching into the car to make an arrest. The 45-year-old driver took off in reverse, dragging the officer and striking a police car, Tucker said. Both the detective and the sergeant fired their weapons, and the driver was shot in the leg and wrist and was hospitalized, police said.

The officer remained hospitalized in stable condition Tuesday night. The names of the officers were not immediately released.

"The detective was hit in the shoulder apparently by the shots that came from his colleague," Tucker said. "His mood was fine. For someone who's been shot, he was awake, he was alert."

A second suspect, a 51-year-old man, also was taken into custody at the scene. Police said they were looking for a third person, who fled from the car.

"Right now it's an active crime scene. We have not found a gun as of yet inside the car," said Robert Boyce, NYPD Chief of Detectives.

Mayor Bill de Blasio visited the injured detective at the hospital, thanking him for his service.

"Tonight's shooting is an important reminder of the critical and dangerous work our police department does each day," de Blasio said in a statement. "We're grateful the detective is doing well, and we wish him a safe and swift recovery."

Bri Brown, a woman who works at a bar near the shooting scene, told The New York Post she went outside when she saw people running past the bar.

"I heard a guy screaming 'I've been shot, I've been shot! Call an officer, I've been shot!'" Brown said.

Suzanne King, 24, a nanny who lives on the corner, said she heard a sound like a crack.

"I didn't think anything of it until (the area) was stormed by cops," King told the Post. "Then I got scared. I saw one person on a stretcher get taken away by an ambulance."

The shooting marks the sixth time since January a New York City police officer has been shot in the line of duty.

"The work that our officers do is dangerous, it's unpredictable and so you have to expect the unexpected all the time," Tucker said.

Last month, two officers were shot during a confrontation with a gunman in Brooklyn. One of the officers was shot in his bullet-resistant vest and the other was struck in the hip.

A little more than two weeks before those two officers were shot, a pair of officers were shot and wounded while on patrol in a public housing stairwell in the Bronx. The gunman killed himself soon afterward, police said. In January, a police officer was wounded in the ankle by a police bullet as another officer exchanged gunfire with a suspect in a Bronx street brawl.

(Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed)