Moral theology distinguishes between human acts (acti humani) and acts of man (acti hominis).
Any voluntary, deliberate, and conscious act freely committed by the person is a human act. Any activity which involves the human free will is considered a human act, and all human acts are de facto moral acts. Anything which is done by virtue of our nature or specific to our species is an act of man, like walking on two legs or speaking.
The physical act of walking is an act of man, unless one deliberately chooses to walk to a place one should not go; for example, if a married man walks to a house of ill repute. His freewill choice was to commit sin, and he employed means to achieve it. Whether he drove a car, took a bus, or walked to the bordello is irrelevant. The act of the will to use walking to enable him to go and sin made this particular act of man a sinful human act. Likewise, learning to swim is an act of man. Jumping into a lake to save a drowning person is a human act because the person had to freely choose to swim out and rescue the person.
Things done while asleep are not human acts because you must be conscious in order to use your free will. All free-willed acts are human acts and therefore are moral acts. Animals act on instinct, so when they attack out of fear or when they mate while in heat, it is nothing more than animal nature at work. When human beings have sex, it is not because they are compelled to from instinct. It is a voluntary and deliberate choice to engage in that activity. Therefore, it is a human act and a moral act. When done outside of marriage, it is sinful.
The act itself, that is, the object of the will, the intention, and the circumstances make up the “sources” of the morality of human acts. All three determine the morality of any human act.
Hence, if the object were the deliberate and intentional killing of an innocent person, it is never justified, no matter how good the intention—even saving hundreds of lives—since the ends never justify the means. Likewise, evil intentions can corrupt good objects; for example, criminals donating money to charity to appear respectable merely to get a light sentence if convicted. One should never deliberately do evil no matter how much good it is thought may come from it. Some objects or acts are intrinsically evil and are always immoral to perform.
Circumstances can diminish or increase culpability or the moral goodness or moral evil of an act but they can never make what is intrinsically evil change into good. Even if I am in a very desperate situation or set of circumstances, this cannot change the evilness of an evil act, such as murder (deliberately killing an innocent person).