NEW YORK — Officers responding to reports of a man threatening people with a gun fatally shot a man carrying a metal pipe, mistaking it for a firearm, the New York Police Department said.

A tense crowd gathered after Saheed Vassell, 34, was killed around 5 p.m. Wednesday in the Crown Heights neighborhood of Brooklyn.

Police had encountered the man before and classified him as emotionally disturbed, according to The New York Times.

Three 911 callers reported that a “man was pointing a silver firearm at people on the street,” according to NYPD Chief of Department Terence Monahan.

Five officers responded and encountered a man matching the description in the 911 calls.

“The suspect took a two-handed shooting stance and pointed an object at the approaching officers, two of whom were in uniform,” Monahan said.

Four of the officers then fired a total of 10 rounds, striking the man, who was later found to be holding a “pipe with some sort of knob at the end,” he said.

Vassell was pronounced dead at a hospital; four officers were treated for minor injuries.

Dozens of police cars converged on the area, and a crowd of about 200 people gathered around the cordoned-off intersection, said 33-year-old resident Shaya Tenenbaum, who added that a few people in the crowd shouted at police.

Andre Wilson, 38, told the Daily News that he had known the victim for 20 years, describing him as a quirky neighborhood character.

“All he did was just walk around the neighborhood,” he said. “He speaks to himself, usually he has an orange Bible or a rosary in his hand. He never had a problem with anyone.”

Wilson said he was shocked that it would come to this.

“The officers from the neighborhood, they know him. He has no issue with violence. Everybody just knows he’s just mentally challenged. This shouldn’t have happened at all.”

The shooting comes after the police killing of an unarmed black man on March 18 in Sacramento, California, sparked two weeks of protests and calls for police reform.

Stephon Clark, 22, was shot by officers responding to a report of someone breaking car windows. Police said they thought he had a gun, but he was carrying only a cellphone.

In a private autopsy commissioned by Clark’s family, prominent pathologist Dr. Bennet Omalu announced that Clark was hit by eight bullets — six in the back, one in the neck and one in the thigh — and took three to 10 minutes to die. Police waited about five minutes before rendering medical aid.