NEW YORK (AP) — 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, officials said.

The suspect also was hospitalized with two gunshot wounds, neither of which was life-threatening.

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

The two officers, a sergeant and a detective who were in plainclothes, had stopped a car in Brooklyn while investigating a suspected heroin deal around 6:15 p.m.

The detective was reaching into the vehicle when the driver took off in reverse, striking a police car and dragging the officer, said Benjamin Tucker, the first deputy commissioner of the New York Police Department.

Both the detective and the sergeant fired their weapons, he said.

The driver, age 45, was shot in the leg and wrist. Police said he had 58 prior arrests.

The detective was shot in the left shoulder, "apparently by the shots that came from his colleague," Tucker said.

He remained in stable condition Tuesday night at Elmhurst Hospital in Queens.

"His mood was fine. For someone who's been shot, he was awake, he was alert," Tucker said at a news conference at the hospital.

The names of the officers were not immediately released.

A second person in the car, a 51-year-old man who authorities said had 17 previous arrests, was taken into custody at the scene Tuesday night.

Police said they were still looking for a third suspect, 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.

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.