A uniformed NYPD officer was shot three times from behind —once into the back of his ballistic vest — during a shootout with a known gang member in Brooklyn on Wednesday night, police said.

The incident unfolded around 11:15 p.m. in Bushwick, when two police officers and a sergeant assigned to the 81st Precinct were inside an unmarked car when they spotted a man “walking briskly” and “blading his body,” Police Commissioner Dermot Shea said at a morning press conference, the New York Post reports.

A shooting had just occurred nearby and the officers were responding, Fox reports.

The officers got out of the car to investigate — at which time the man pulled “a firearm, turns on the officers and begins to shoot,” Shea said. 

“The sergeant in the auto does not fire his weapon, and again this is all preliminary,” the commissioner added. “One of the officers fires 12 rounds. One of the officers fires nine rounds.”

The wounded officer — identified Thursday as Brian McGurran, who has four years on the job and is assigned to the 81st Precinct — was shot in his vest, as well as the buttocks and right leg, Shea said. 

McGurran was rushed in stable condition to Kings County Hospital, where he was released Thursday to cheers and applause from fellow officers.

The suspect was hit in the leg and taken to the hospital, ABC7 reports. Charges are pending.