We do this with plenty of crimes. Murdering your spouse to collect their life insurance policy is punished harsher than murdering your spouse after you come home to find them having an affair. Motivations and intent matter.
That was one example of the law no acting based purely on result. If you want specifically an example of motivation what about killing in self defense? That is a motivation and not an intent. It can also be what decides guilt or innocence.
Intent does, but intent is different from motivation. Do I need to explain that?