In both the Qur’an and the bible say in the law of revenge that you can take “an eye for an eye” or a “life for a life”.
This is used to justify capital punishment (the death penalty) and corporal punishment (punishment of the body) for murderers.
Some people argue that this is a deterrent.
If you threaten to kill murderers then they are less likely to murder.