You can only kill a detective if he is actively trying to kill you. Meaning you can only shoot back while he is shooting you, if he stops, you can't kill him.
The above answer isn't worded 100% correctly The detective only has to be shooting AT you with the intent to kill, so if they Kos you then shoot in your general direction it's safe to assume there's an intent to kill, or if they taze you then attempt to shoot your ragdoll