A police officer is hospitalized after being shot three times in Brooklyn while responding to a shooting late Wednesday night. This comes as shootings are on the rise across the city.

The incident unfolded at 11:11 p.m. after ShotSpotter, the NYPD's technology that detects gunfire, was activated near the intersection of Madison Street and Broadway near the Bushwick/Stuyvesant Heights border, according to NYPD Commissioner Dermot Shea at a news briefing early Thursday morning. Two uniformed officers and a sergeant in an unmarked car were headed to the scene when they found a bleeding man as he was walking on Macon Street and Howard Avenue, several blocks from the incident.

When the man stopped, he took out a firearm and began shooting, triggering a gunfight, according to Shea.

“The sergeant in the auto does not fire his weapon,” Shea said, while joined by Mayor Bill de Blasio and high-ranking NYPD officers. “One of the officers fires 12 rounds. One of the officers fires nine rounds. The officer that fires nine rounds — and we’re not identifying him at this time as we complete notifications — is struck, we believe, three times.”

The officer was hit in the vest, right leg, and rear end, Shea said. He was rushed to NYC Health + Hospitals/Kings County and is expected to recover. The suspect was shot once in the leg and arrested at the scene.

"This is an example of extraordinary bravery," de Blasio said. "Here are officers in a situation when they see someone acting suspiciously. And they go and do what we depend on them to do every single day and protect our fellow New Yorkers. And they do it with courage and bravery."

Police did not explain whether the shooter was linked to the incident at Madison Street and Broadway. Shea said surveillance video there showed a man running up to a white SUV with three men inside and firing a gun. The suspect killed one man and wounded another, according to Shea. The SUV drove off, but soon crashed. Shea said the men inside the vehicle were known gang members with criminal records.

Shootings have increased so far this year: NYPD stats noting incidents up to May 2nd show a total of 416 shooting incidents this year, compared to 216 during the same period in 2020, an 83% increase. The number of shooting victims stands at 463 so far this year, compared to 259 the same time a year ago, a 78% jump.

The gunfight also comes days after a 4-year-old girl and two others were shot by stray bullets in Times Square. A suspect in that shooting was apprehended in Florida on Wednesday. It also comes several weeks after an alleged drunk driver crashed their car into a highway police officer while on duty.

"Again, we find ourselves in the hospital in the middle of the night," Shea said. "It's by the grace of God that we are not about to start planning for a second funeral."