The man, whose identity has not been released, was being treated at San Francisco General Hospital for life-threatening injuries sustained during a confrontation with officers, police Lt. Troy Dangerfield said.
Police had responded to a report of a stabbing at 3:51 p.m. at a home in the 600 block of Bacon Street.
Officers entered the home and made contact with the suspect, who allegedly had some type of knife in his hand, Dangerfield said.
Police asked the man to put down the knife, but instead he allegedly came toward the officers, who opened fire on him, according to Dangerfield. The suspect was taken to San Francisco General Hospital with life-threatening injuries, he said.
The victim who originally reported the stabbing was treated for non-life-threatening injuries and released, he said.