Shots were fired around 5:20 p.m. as officers served the warrant at an apartment in the city, reports said.
One of the officers was killed in the shooting, while the other injured and transported to an area hospital in stable condition, according to the San Luis Obispo Police Department.
The suspect was killed by police, authorities said.
“The suspect is deceased and there is no threat to public safety at this time,” tweeted the department.
Victoria Torres, 21, a neighbor, said she was upstairs in her bedroom when she heard “a very loud knocking” at an apartment across from her.
“I don’t know if it was the police or what,” she told the San Luis Obispo Tribune. “I always hear noises here so I didn’t think anything of it until I heard the gunshots.”
Torres said she walked downstairs, looked out a window, and saw a man carrying a “big gun” who began shooting at officers from the door of an apartment. She noted that officers were hiding behind their car, the paper reported.
“I was pretty startled and frightened,” she said. “I just hid. I looked out the window again when it got quiet. Because I wasn’t sure what happened.”
Soon after, Torres said she decided not to watch anymore because “it was too scary,” according to the San Luis Obispo Tribune.
Another resident, Monica Rochte, 31, told the paper she heard police banging on an apartment door across the street, saying “We’re going to come in. We know you’re in there.”
Rochte said the yelling continued before she heard a bang, and then a single shot. She then heard police yelling “He has a gun!” before a series of 15 to 20 shots rang out.
“This is a tragedy beyond measure for all of those who serve and care about our community,” said Derek Johnson, San Luis Obispo City Manager. “Our deepest condolences go out to the family. We are devastated by this loss.”