The ends justify the means

Overview
The phrase "the ends justify the means" (or "the end justifies the means") is an expression of either of two ideas:
 * 1) Morally wrong actions are sometimes necessary to achieve morally right outcomes.
 * 2) Actions can only be considered morally right or wrong by virtue of the morality of the outcome – in other words, it's okay to break the rules if the results are good (or, more crudely, "if you get away with it").

Analysis
Many or most people would probably agree with the necessity of the first idea (e.g. stealing bread to feed a starving child) in certain cases, although this doesn't necessarily argue also that the morally wrong actions should therefore be unpunished. The essential ingredient, in any case, is the idea that committing a morally wrong act in pursuit of a morally right outcome does not automatically negate the rightness of the act overall, although it may turn out that it does invalidate it anyway when carefully evaluated.

The second idea, however, when invoked in practice as justification for immoral acts, tends to require viewing the badness of the "means" in predominantly local terms, overlooking the harm done purely by the (perhaps small, but cumulative) erosion of the social inhibition against committing the immoral act (the "means"). (This is basically an instance of the slippery slope argument, but it seems valid in this case.)

In the "stealing bread to feed a starving child" example, it is easy to imagine that if the theft were not in some way adequately punished, there would be some gradual erosion of the social taboo against stealing. Perhaps the first person who steals bread to feed their starving child waited until the very last possible moment – the child will die within the hour if not fed, and there are simply no other options – and steals only from a source which is known to have an adequate supply of bread. However, perhaps the next person who is tempted to steal bread for their starving (or merely very hungry?) children isn't so meticulous in her/his decisionmaking, having seen that the first one "got away with it".

If the evaluation of the outcome includes an evaluation of the harm done merely by breaking the rules (as a part of whatever immoral acts were included in the "means"), evaluation of morality purely in terms of outcome becomes much more congruent with many more traditional absolutist views of morality – although the two philosophies still arrive at different answers in certain areas.

Note 1
It may be that the best way to evaluate such things would be to apply the same ethical standards to both the "means" and the "end", and somehow subtract the "punishment" from the "reward" in order to arrive at a reasonable net compensation to the individual performing the act... or perhaps the individual should be subject to both the standard punishment and standard reward... though if the punishment is sufficiently harsh as to deprive the perpetrator of any enjoyment of the reward, it may be necessary to re-evaluate both, in order to decide if the net effect upon the perpetrator seems appropriate to the net results caused by them.