When a moral agent wishes a good end to a human act ( the person’s intention), the means by which the intention is achieved cannot be evil. Both means and the end must be moral for the act to be morally good.
For example, if someone does not wish an ill parent to suffer (a good intention); they cannot employ an evil means like euthanasia (an evil act) to achieve their intention. On the other hand, if someone wishes the cessation of suffering and employs legal drugs to help, the act would be considered an acceptable moral act. Simply, the “means” and the “end” taken together in their totality, have to be free of evil in order for the act to be considered a good moral act.