When officers arrived, a suspect came at them pointing what looked like a handgun, police say.

Seven police officers fired a total of 42 rounds at the scene. Simonsen was shot in the chest from officer fire, and died. Simonsen, 42, was with the department for 19 years. His partner was wounded.

In this undated photo provided by the New York City Police Department, Det. Brian Simonsen is shown. Simonsen was shot and killed by friendly fire Tuesday night.(Photo: AP)

Police officers say Ransom, who has been arrested at least 11 times since 2012, was holding a fake gun.

In 2016, Ransom pleaded guilty to criminal trespassing after he allegedly walked up to a desk at a Brooklyn police station wearing a fake SWAT vest and police badge. Years earlier, he was sentenced to jail time for impersonating an intern to get into a judge's chambers.

Contributing: The Associated Press. Follow Ashley May on Twitter: @AshleyMayTweets