The Torah decrees the death penalty for wanton murder. Period. A fair trial should be held and if evidence is conclusive, execution should follow swiftly. “Thus you shall remove evil from your land.” To allow the murderer to live makes you an accessory to it. Murder has two components; 1) You kill your victim. 2) You live on to gloat over their death. To allow the murderer to live kills Justice.
There’s a lot more to it than that. The death penalty implies some means of thoughtful consideration, not spontaneous self defense. For example, a home invasion robber at night can be killed, even if a thief during the day cannot.
And certain crimes, such as the worship of Moloch with the sacrifice of children, are so profane that even accessory to them is worthy of the death penalty.