An idea from Groundwork of the Metaphysics of Morals
The rule you act on is called a maxim, your personal policy for a kind of situation. An act’s worth comes from that rule, not from the result, since luck or someone else could bring the same result. “Duty is the necessity of acting from respect for the law.”