Even within Buddhism, there are various descriptions of this, but in the Mahayana tradition it [is] taught that the main criterion for an action being virtuous or non-virtuous is whether one’s intention is or is not virtuous. If you hold the motivation in your mind to be of benefit to others and that they may come to enjoy temporary and ultimate happiness and well-being, whatever actions of body, speech, and mind you may perform, they will all be on the side of virtue. But if you act with a negative mindset, out of a motivation that is afflicted by being jealous, malicious, competitive, and so on toward others, whatever you do will be non-virtuous. In brief, whether an action is considered as virtuous or non-virtuous depends mainly upon the underlying motivation or mindset either positive or negative. The results of good actions will also be good, while the outcomes of bad actions will be negative and painful.
– 17th Karmapa
from the book “Heart Advice of the Karmapa”