Acquinas has a compelling position:
The act of self-defense may have two effects, one is the saving of one's life, the other is the slaying of the aggressor. Therefore this act, since one's intention is to save one's own life, is not unlawful, seeing that it is natural to everything to keep itself in "being," as far as possible. And yet, though proceeding from a good intention, an act may be rendered unlawful, if it be out of proportion to the end. Wherefore if a man, in self-defense, uses more than necessary violence, it will be unlawful: whereas if he repel force with moderation his defense will be lawful, because according to the jurists [Cap. Significasti, De Homicid. volunt. vel casual.], "it is lawful to repel force by force, provided one does not exceed the limits of a blameless defense." Nor is it necessary for salvation that a man omit the act of moderate self-defense in order to avoid killing the other man, since one is bound to take more care of one's own life than of another's. But as it is unlawful to take a man's life, except for the public authority acting for the common good, as stated above (Article 3), it is not lawful for a man to intend killing a man in self-defense, except for such as have public authority, who while intending to kill a man in self-defense, refer this to the public good, as in the case of a soldier fighting against the foe, and in the minister of the judge struggling with robbers, although even these sin if they be moved by private animosity.
Then, it seems that there are situations where the death penalty is just, but once someone is captured those situations are rare. We shouldn't administer the death penalty for the sake of killing someone, instead we should first have a (just) goal for which the death penalty is the only option to achieve it.
What things a group punishes with the death penalty will therefore depend on, for example, how capable the authorities are at retaining prisoners.