St. Thomas Aquinas (1225 - 1274)
Summa Theologica, II; 65-2; 66-6.
"If a man is a danger to the community, threatening it with disintegration by some wrongdoing of his, then his execution for the healing and preservation of the common good is to be commended. Only the public authority, not private persons, may licitly execute malefactors by public judgement. Men shall be sentenced to death for crimes of irreparable harm or which are particularly perverted."
Summa Theologiae, IIa, IIae, q. 64, art. 2
Every part is directed to the whole, as imperfect to perfect, wherefore every part exists naturally for the sake of the whole. For this reason we see that if the health of the whole human body demands the excision of a member, because it became putrid or infectious to the other members, it would be both praiseworthy and healthful to have it cut away.
Now every individual person is related to the entire society as a part to the whole. Therefore if a man be dangerous and infectious to the community, on account of some sin, it is praiseworthy and healthful that he be killed in order to safeguard the common good, since "a little leaven corrupteth the whole lump” (1 Cor. 5:6).
St. Augustine (354 - 430)
The City of God, Book 1, chapter 21
“The same divine law which forbids the killing of a human beings allows certain exceptions, as when God authorizes killing by a general law or when He gives an explicit commission to an individual for a limited time. Since the agent of authority is but a sword in the hand, and is not responsible for the killing, it is in no way contrary to the commandment, "Thou shalt not kill" to wage war at God's bidding, or for the representatives of the State's authority to put criminals to death, according to law or the rule of most just reason.”
This thought has been attributed to Thomas Aquinas but I could not find the the source.
Executions represent mercy to the wrongdoer:
"...a secondary measure of the love of God may be said to appear, for capital punishment provides the murderer with incentive to repentance which the ordinary man does not have, that is a definite date on which he is to meet his God. ...the law grants to the condemned an opportunity which he did not grant to his victim, the opportunity to prepare to meet his God. Even divine justice here may be said to be tempered with mercy.