Motivation is actually taken into account when charging someone for a crime in some cases. At least intent is taken into account. It is the difference between manslaughter (not premeditated) vs. murder (premeditated). It is also considered in cases of accidental death through negligent behavior (involuntary manslaughter) and direct cause of death due to actions (voluntary manslaughter). I believe this is correct, but I am not a lawyer.
If a man walks in on his wife having an affair and in a rage grabs her and shoves her resulting in her falling, striking her head, and dying- he can be charged with manslaughter. If he leaves, gets a weapon, and goes back to the house and kills her, he will likely be charged with murder. Results are the same- she is dead. He is the cause in both scenarios. It is intent that makes the situations different. Isn't this similar to hate crime laws?