A masked gunman who allegedly opened fire at an occupied police vehicle has died after a shootout with cops in Brooklyn, police say.

In a police chase and shootout that ended in a Brownsville backyard, police estimate officer fired more than 60 rounds.

In a press conference Monday morning, Chief of Department Terence Monahan said officers approached a man on Howard Avenue early Monday morning when they saw he was wearing a mask. The man ran away when approached, and as officers followed him, he took out a gun and shot at their vehicle, they say. One of the officers then returned fire, shooting about nine round, Monahan said.

The suspect, who has not been identified, then escaped, but about 30 minutes later cops got a call about a man attmpting to break into a backyard on Howard Avenue. "As uniformed patrol officers gained entry to the backyard they were fired upon numerous times and exchanged gunfire with the perpetrator. These officers became pinned down at the location due to the perpetrator firing," Monahan said. More cops arrived and shot about 55 rounds at the suspect, hitting the man and taking him into custody.

He was transported to a local hospital and later confirmed dead.

Monahan said a semi-automatic handgun was recovered in the backyard.

Videos posted by residents on Citizen App show heavy police presence in the area, with at least a dozen officers at the scene. Police later released surveillnace footage of the scene, which shows the suspect running and firing a gun. An officer chasing him stops before firing multiple times in the suspect's direction.

No officers were injured in the shootout, according to Monahan.