BUSHWICK, Brooklyn -- Two suspects are in custody and one is still on the loose after a friendly fire incident during a narcotics operation that resulted in a NYPD narcotics officer being shot Bushwick Tuesday night.

The shooting happened around 6 p.m. in the area of Wilson Avenue near Troutman Street. Police say the officer was involved in a narcotics operation when shooting occurred.

Officials say the officer and detective approached the car on both sides after an alleged heroin sale had just occurred. When the officers identified themselves as police, the suspect's car backed up, striking the police vehicle.

The detective then reached into the car from the passenger's side to make an arrest. The driver then took off while the detective was partially in the vehicle. At this point, both officials at the scene fired their weapons.

A total of four shots were fired and the officer may have been hit by crossfire.

The plainclothes detective was transported to Elmhurst Hospital in Queens with a gunshot wound to his shoulder, police say. His injuries are not considered to be life threatening. Officials say he is awake, alert and in stable condition.

The detective, who is described as being in "good spirits for someone who just got shot," is being monitored by doctors.

The driver of the car was shot twice in the leg and the wrist. He is being treated at Bellevue Hospital and is in stable condition.

Another suspect is in custody and the third is still on the loose. Police will be releasing a photo of the suspect in the next few hours.

Both suspects have lengthy arrest records.

Officials say they have not found a gun at this time.