 Either protecting themselves or the public, they do it, right? Part of the police's job, though, is to neutralize a threat, and they are allowed to neutralize a threat with deadly force if it's a threat to them or if there's a threat to somebody else. If somebody is being threatened with bodily harm in some way, they can neutralize that threat basically by shooting the guy. They can't just go out and shoot somebody. They can't murder somebody, which would be if they didn't have justification to shoot.