San Francisco police shot and killed a knife-wielding man in the Bayview District on Wednesday.

The violent incident was recorded on a cellphone by a witness, who later posted the footage to Instagram.

Warning: The video is graphic.

A video posted by HotRod (@daniggahot) on Dec 2, 2015 at 4:59pm PST

The footage shows a man apparently limping on the sidewalk surrounded by a group of armed officers.

A nearby witness apparently calls for the man to "just drop it," as he wavers off to the side. He steps toward an officer, and then the camera turns as a number of shots are fired.

According to CBS San Francisco, police said the 20-something-year-old suspect was involved in an earlier stabbing nearby.

"This suspect had already shown by committing a felony aggravated assault that he was a danger to others, so he could not be allowed to move away from the scene," Police Chief Greg Suhr said.

Suhr alleged the officers deployed the standard beanbag gun at first, but the suspect did not drop the weapon, leading the police to fire.

At least 15 shots can be heard in the video.

Paramedics attempted to revive the man, but were unsuccessful.

Public Defender Jeff Adachi told the San Francisco Chronicle that, based on the footage, he did not believe the suspect was posing a direct threat.

"It does not look like the officer who fired the fatal shots was in immediate danger of being killed," Adachi said. He added it looked as if the officer "[could] move back and at least order the person to the ground or use some other sort of defensive maneuver, rather than using a gun and shooting him point-blank."

This incident comes in the midst of several nationwide instances of black men being shot and killed by police. Recently, protesters took to the streets of Chicago, after video footage was released of cops shooting teenager Laquan McDonald to death, nearly a year after the incident.