NYPD officers shot a 22-year-old man in Brooklyn on Tuesday night after they interrupted a gunfight in Flatbush, police said.

Assistant Chief Frank Giordano said officers from the 70th Precinct were patrolling near Ocean and Church avenues around 7:30 p.m. when they heard gunshots and saw two people exchanging fire.

“Our officers ran towards gunfire, and they bravely and immediately confronted a dangerous situation,” Giordano said at a press conference. “They observed the situation and they engaged very, very quick.”

The officers exited their patrol car, drew their weapons and shot at one of the men, striking him at least once, Giordano said. Police said they recovered a Ruger 9mm handgun and multiple shell casings at the scene.

Officers performed life-saving measures before the man was transported to Kings County Hospital, where he was listed in stable condition, police said. They identified him as Edynesson Bauduy.

Giordano said Bauduy is a “two-time convicted violent felon” who had been released from prison about two months ago and is on parole until 2030. State prison records show he was previously convicted on assault and robbery charges and was released in June.

“This is a person who has repeatedly shrugged his shoulders at consequences and at our criminal justice system for these violent crimes that he committed,” Giordano said.

Law enforcement officials haven't yet announced charges against Bauduy in connection with Tuesday's incident and attorney information for him was not immediately available.

The second person involved in the shootout fled the scene and had not been located as of early Wednesday, according to police. Officers who discharged their weapons were taken to a hospital for evaluation.

Police said body-worn camera footage captured the encounter and the NYPD’s Force Investigation Division is reviewing the incident.

Brittany Kriegstein contributed reporting. This story has been updated with additional information.