A veteran NYPD detective was shot in the back by what investigators believe was friendly fire during a chaotic encounter with an armed 18-year-old early Sunday in Crown Heights, Brooklyn, according to law enforcement sources. Detective Robert Karroll, who was just 10 days from retirement, was struck by a projectile while inside an unmarked police vehicle with three other officers.

The incident occurred around 4:15 a.m. when the teen approached the Kia SUV. Surveillance video shows the gunman pacing with a 9mm handgun and racking a round into the chamber before approaching the vehicle. Sources indicated the teen fired his weapon, and there are more than a half-dozen bullet holes in the vehicle, though it remains unclear if the teen was aiming at the officers or is responsible for all the damage.

Three of the four officers in the vehicle discharged their firearms during the confrontation. The suspect was not injured. Karroll sustained a non-life-threatening gunshot wound to the back, with his bulletproof vest preventing more severe injury. A female officer also suffered minor injuries during the incident.

The unidentified gunman was apprehended several blocks away and is awaiting charges. He has no prior arrests in New York City but has a shoplifting charge in New Jersey. The teen has not yet been formally charged.

Karroll was released from the hospital later Sunday and is expected to make a full recovery. The detective is a married father of three.

NYPD Crime Scene Unit detectives investigate the scene where an officer was shot in Crown Heights, Brooklyn.