From St. Alphonsus' Theologia Moralis, courtesy the Lex Christianorum weblog:
An, et quomodo liceat occidere malefactorem.376. An liceat occidere Proscriptos propria auctoritate? . . . .Resp. Extra casum necessariae defensionis, de quo infra, nulli id licet, nisi auctoritate publica, et juris ordine servato, ut patet Exod. 22 et Rom. 13.. . . Secus est de proscriptis quos occidendi cuius acutoritas publica datur: idque non injuste, cum ad Reipublicam defensionem sit necessarium. (Modo occisio non fiat extra territorium proscribentis: nisi praesumatur licentia alterius principis. Sal. De V Praec. C. 2 n. 19 Vide. n. 380. Vers. Decius) Peccant tamen qui no ex zelo juistitae, sed odio, aut privatae vindicate causa id faciunt. Vide Laym. l. c. Peccat Princeps, vel Magistratus (regulariter loquendo) ut vide infra l. 4. c. 3 d. 1 qui occidi juebt reso non citatos, vel no auditos, vel non damnatos, etsi privata scientia conste eos esse nocentes; quia ex jure naturae actus publicus fieri debet ex scientia et auctoritate publica. Vide Caj. V. Homicidium, Fill. Tr. 29. C. 2 q. 6 n. 27. Bon. L.c.p.1 n.7 Vide et infra l.4.c.3.d.1. (Excipe 1. Si crimen set notorium. 2. Si esset periculum seditionis, aut esset dedecus Regis, si juridice procederetus. Salm. Ibid. num. 18)"
Whether, and in what manner, is it lawful to kill a wrongdoer376. Whether it is lawful for proper authority to kill a criminal?376.Response: Other than the case of necessary defense, of which more below, no one except public authority may lawfully do so, and then only if the order of the law has been observed, as is made clear in Exodus 22 and Romans 13.. . . . The public authority is given the power to kill wrongdoers, and that not unjustly, since it is necessary for the defense of the commonwealth. (Killing may not be done outside of the criminals territory, neither is it presumed that another prince has this right.) They also sin who kill not out of the zeal of justice, but out of hate, or private vengeance. Vide Laym l.c. Similarly, a prince or magistrate sins (normally speaking) see below l. 4. C. 3. D. 1, who orders a wrongdoer to be put to death without being properly cited, or heard, or adjudged (by public trial), even it if he has personal knowledge of that persons guilt, because as a matter of natural law, a public act ought to be derived from public knowledge and authority. There is an exception to this rule if: (1) the crime is notorious, or (2) if there is a danger of sedition, or the Kings disgrace, if the cause proceeds juridically."
In his teaching here, St. Alphonsus follows the unvarying and infallible doctrine of the Church regarding capital punishment, as witnessed in Holy Scripture, in the doctrine of Our Lord and the Holy Apostles, in the unanimous consent of the Fathers, and Holy Church's Magisterium. God forbid that any should do less!
O God, who through the burning zeal for the salvation of souls of Blessed Alphonsus Maria, Thy confessor and bishop, didst enrich Thy Church with fresh offspring, grant, we beseech Thee, that, imbued with his wholesome doctrine, and strengthened by his example, we may, by Thy grace, come happily unto Thee.
Through Our Lord Jesus Christ, Who liveth and reigneth with Thee, in the unity of the Holy Spirit, God, world without end. Amen.
-- Collect for the traditional Proper Mass of St. Alphonsus Maria de Liguori