Understanding The Principle Of Double Effect
Human acts are freely chosen because God has given us the gift of freedom. When we act deliberately, we are the author of our actions. If we act, then those actions can be morally evaluated as good or evil.
The sources of human morality depends on three things: 1) the object chosen, 2) the end in view or the intention, 3) and the circumstances of the action (cf. CCC 1750).
The object is the good which is chosen. Of course, all that God has made is good. Thus, even our sins could be seen as the choosing of a lesser good in the place of a greater good. The object of an action is external to the person choosing it. In other words, the object of the act can be in itself good or evil (cf. CCC 1751).
The intention is in the person acting and helps us evaluate if an act is good or evil by determining the end towards which someone is aiming by acting. However, if an object deliberately chosen is bad, then no intention can make it a good act. On the same token, you may have an objectively good act, such as almsgiving, which is subverted by a bad intention such as vanity (cf. CCC 1752-3).