Police fatally shot a man in Brooklyn after a vehicle pursuit in Crown Heights Thursday.

Officials said the man was wanted for a homicide back in March. A still from bodycam footage shows the man pointed a gun at officers, a gun they said is illegal and can carry dozens of bullets.

When the man, who was in the passenger seat, aimed the gun at officers, police say they fired 18 shots, injuring the man who later died at the hospital.

Officers said they also shot the driver, who they say tried to flee the scene. A three-year-old was also in the back, according to officials.

Once officers were aware of the child, they say they stopped firing and took her to safety. Officers said she is unharmed.

At a news conference, Chief of Department Jeffrey Maddrey described the scene.

“The person on the passenger seat tries to exit the vehicle, but they couldn’t open the door all the way because of a double-parked vehicle. But that person did have a gun in his hand and he pointed it at our officers. At this point, our officers started firing — they’re giving commands to drop the weapon, to show their hands,” Maddrey said.

No officers were injured during the incident and the investigation is ongoing.