No doubt this is how we should understand the scriptural passages that command us to love our neighbour and even our enemy. We can’t be commanded to feel love for someone, or to simply prefer that he thrive. There are two sorts of love: practical love that lies in the will and in principles of action, and pathological love that lies in the direction the person’s feelings and tender sympathies take. The latter of these cannot be commanded, but the former can be – and that is a command to do good to others from duty, even when you don’t want to do it or like doing it, and indeed even when you naturally and unconquerably hate doing it.
The second proposition is: An action that is done from duty doesn’t get its moral value from the purpose that’s to be achieved through it but from the maxim that it involves, (giving the reason why the person acts thus).
So the action’s moral value doesn’t depend on whether what is aimed at in it is actually achieved, but solely on the principle of the will from which the action is done, irrespective of anything the faculty of desire may be aiming at. From what I have said it is clear that the purposes we may have in acting, and their effects as drivers of the will towards desired ends, can’t give our actions any unconditional value, any moral value. Well, then, if the action’s moral value isn’t to be found in the will in its relation to its hoped-for effect,
where can it be found? The only possible source for it is the principle on which the will acts – and never mind the ends that may be achieved by the action.
— Kant, Groundwork for the Metaphysic of Morals (translated by Jonathan Bennett)