The NYPD is searching for a third suspect following a shooting that left a police officer wounded by friendly fire during a drug arrest.

The plainclothes detective and his partner had stopped a car in Brooklyn on Tuesday night while investigating a suspected heroin deal.

The officer is listed in stable condition Wednesday with two gunshot wounds to the shoulder.

Police say he was reaching into the vehicle when the driver took off in reverse, striking a police car and dragging the officer.

They say both officers fired their weapons.

The 45-year-old driver was shot in the leg and wrist. A second person in the car also was taken into custody. Charges against them were pending. Police say both men had multiple previous arrests.

A third man in the car fled.