This post pushes more deeply into the question of punishment raised previously, on the purposes of punishment according to Thomas Aquinas, and the proportion of punishment to a crime and its motives and circumstances. Why is punishment just at all? How is punishing someone, doing something bad to them because of something bad they did, any different from hating someone because they hate me? Merely increasing human evil, rather than limiting it?
Many and various desires
Men have multiple goods to which they are ordered, and multiple motivations for their actions.
Men ultimately desire to obtain all of those goods together. (Though one cannot attain each and every good that one might potentially desire, the attainment of some good in another manner may put to rest the desire that would incline to that thing; e.g., a person might not have children himself, but yet in another manner attain to the good of continuing his own existence and upholding the existence of human race.) The obtainment of these goods taken together is called happiness.
Men can, as a rule, only obtain the goods they are seeking, or happiness, as members of a human community.
Desires which come into conflict
The desire for particular and private goods can, and often does, lead people to act in a manner harmful to the common good of a community. For example, if one doesn't have a toilet, it may be convenient and tempting to dispose of one's waste in the nearest river. Or one may covet property belonging to someone else, and seize an opportunity to take it when he is away.
Similarly, the desire for one's own good, may hinder someone from acting for the common good. E.g., the fear of death may hold someone back from defending the community against invaders.
If these situations are not regulated within the community, in such a way as to counteract the temptation to prefer private good over common good, (and short-term benefit over long-term benefit, immediately perceptible goods over one's hard to perceive, etc.), the community suffers harm. It may be destroyed, and cease to exist as a community. Or the situation may "regularize" itself, when an individual seeking to better his own situation, and not restrained by community rule, ends up dominating the community. In the former case, the result is clearly bad for everyone. In the latter case, the result is bad for those subjected to tyrannical rule, inasmuch as the rules of the community imposed by a tyranical individual or group, will tend to disadvantage the subjects in many ways, and inasmuch as one of the goods people generally desire is to act freely. And bad for those ruling tyrannically, inasmuch as their natural desire for the good of their fellow-man has been distorted and perverted; in addition, they may fear rebellion or death at the hands of their subjects, and the like, but these are only secondary reasons why a tyrant is not truly happy.
Regulation of desire
How does a community regulate the matter, so that someone, despite a desire for some personal good, refrains from acting on that desire in a situation when it harms the community?
Is it enough to lay down rules describing what is to be done? "Do not dispose of waste in the river; do not steal" or other similar rules of behavior?
Where the private benefit gained by ignoring the rules is tiny, and the harm resulting from ignoring the rules is manifest and impacts the rule-breakers themselves, that may by and large be enough. For example, it might suffice to lay down the rule that on roads with two lanes and traffic in both directions, cars are to drive on the right-hand side except when passing. Since people have little to gain and much to lose (being injured or dying in an accident) from ignoring the rule, it might not be necessary to coerce anyone to follow the rule with the threat of fines or imprisonment.
Again, in a small community where the common good is much more manifestly part of the individual's happiness, such as in a family (of adults or of adults and older children) or in a religious community, it might seem sufficient to lay down rules needed to uphold the common good, at least if there is a consensus about which rules are needed for the common good. For example, "flush the toilet after using it", "don't leave toothpaste in the sink" etc. In this case, the mutual care for fellow members of the community might provide sufficient motivation to follow the rules, even when one is in a hurry and would get some private benefit from ignoring them.
In actual fact, though, men frequently act contrary to the common good, in order to attain some personal good, and that, even when they know it is not only contrary to the common good but ultimately detrimental even to their own happiness. E.g., a spouse may peruse pornography, though knowing that it is detrimental to spousal friendship and ultimately to their own happiness. Even more so when they believe themselves personally to be better off for ignoring the rules, or are unpersuaded of the rules value even for the common good.
Regulation in real life requires incentives (rewards) and disincentives (punishments)
For this reason, in order that the rules for the common good actually rule, i.e., modify men's behavior for the sake of the common good, it is necessary to incentivize the members of the community who are to follow the rule, by giving "rewards" for the good behavior that is to be encouraged (i.e., actions for the common good which men are not adequately encouraged to do by reason of their innate goodness, perhaps because they involve a sacrifice of some private good) and/or "punishments" for bad behavior that is to be discouraged (actions contrary to the common good which men are not adequately discouraged from doing by reason of their innate badness or natural consequences).
In the political context, many laws, or rules for behavior, will not sufficiently function to rule or order men's behavior, unless there are consequences for failing to obey those laws, and consequences more undesirable than those goals are desirable that would lead men to act otherwise, in the absence of penal consequences. (It is not enough if the punishment is only equally bad as the desired object is good — if a man is punished for stealing $100 by a fine of $100 over and above haven to return the money, since men will not always be caught, they could easily still be inclined to steal, if they think the chances are good of getting away with it.)
Why punishment is reasonable and just
The punishment laid down in advance as a punishment to be imposed for breaking a law, has the purpose of making that which is bad with a view to the common good, manifestly bad, manifest both to an individual who will suffer punishment if he does that bad deed, and to the community at large.
Thus lawfully threatened punishment is a deterrent to potential lawbreakers.
The threat of punishment can only be a deterrent, however, if the punishment is, at least in general, then actually inflicted upon lawbreakers who break the law. Consequently, a punishment laid down for breaking a law may be said to be due to the lawbreaker, and a requirement of justice, and in this sense, the retribution of lawbreaking by punishment is something good, the rendering of what is due to him by just and reasonable law.
The imposition of punishment (or the explicit freeing from it in a particular case thorugh a declaration of pardon or amnesty) can also be described as reestablishing the equality of innocent and guilty before the law — as the innocent followed the law and was not punished, so the guilty broke the law to his own advantage and was punished to his disadvantage. That such "compensation" or "retribution" is just, however, presupposes, that the punishment is in the first place a reasonable and so just punishment to set down for the crime. To wish evil on someone is bad, and does not become good just because he did something bad to you.
Inasmuch as it is good to be inclined to good deeds, and bad to be inclined to evil ones, punishment imposed on the lawbreaker may have a good effect even on the lawbreaker himself. Thus imposed punishment may help to rehabilitate the lawbreaker, help to make him realize the wrong he has down and disposed to do better in the future.
Further, the imposition of punishment strengthens the credibility of the antecedent threat of punishment and therefore its deterrent value in relation to potential lawbreakers.
Punishment as earned by the wrongdoer, the "just deserts" of wrongful deeds, is not an innate metaphysical quality of unjust actions, but follows from the reasonable and therefore just ordering of human life in community to happiness. Punishment that must, as a rule, be threatened and consequently imposed by law if human communities are to continue to exist and attain their goals is just. Punishment that it is not reasonable for a community to threaten and consequently impose with an aim to preventing evils and promoting good, is not merely imprudent but also unjust. If punishing theft by cutting off the hands of thieves were necessary for humans to live together in community, this punishment would be just. But in fact, such punishment seems to have been unnecessary and excessive not only today, but in all human societies, and therefore always unjust.