Murder is the most serious crime on the books. A conviction can lead to life in prison and sometimes even the death penalty.
In some cases, a person who commits a killing can get the charge reduced to manslaughter or even involuntary manslaughter. Both of these can still lead to prison, but usually a far shorter sentence than an actual murder conviction.
In other cases, a person who does a killing can “walk” (that is, not suffer any conviction and not be sentenced to any custody time). We call these instances in California law of excusable or justifiable homicide.
As you might imagine, only in exceptional circumstances does the law allow someone to kill another person and walk away with impunity. Most often, this happens in the context of self defense, defense of others, true accidents, or effecting the arrest of violent felons.
So who decides when a homicide is excusable or justifiable? In the first instance, it's the prosecutors. They decide at the outset whether to file murder or other charges, or whether to file no charges at all against the suspect.
But the ultimate arbiter of excusable homicide is the jury. They have the power to convict someone of murder, or to find the person not guilty based on the justification he asserts.