Book 3 chapter 1 of Aristotle’s Nicomachean Ethics deals with willing and unwilling actions. “Praise and blame come about for willing actions, but for unwilling actions there is forgiveness and sometimes even pity…” (Sachs translation, p.36.)
Unwilling acts are those that are forced by someone else, or come about through ignorance. Those that come about through ignorance include cases when people are talking and something slips out unintentionally, as well as all sorts of mistakes. Things done on account of spiritedness or desire, as well as those done on account of reasoned deliberation, are considered willing.
There are mixed cases in which the act would normally be done only if it were forced, but in particular circumstances it is done willingly to avoid a greater evil or to realize a greater good. Tradeoffs of this sort generally deserve praise or blame based on the goodness or badness of the tradeoff, but in extreme cases, mixed actions may just deserve forgiveness or pity.
Aristotle says there are perhaps some things one should never do regardless of the tradeoff, but that these cases are difficult to distinguish. He notes that it is in general not easy to say whether or not the ends justify the means. (See also What We Really Want.)