Sir, I thought very carefully before giving my original answer and this question has been posed before elsewhere as I am sure you are already aware. It is often used to catch believers out, just as those who asked Our Lord whether it was lawfull to offer tribute to Caesar tried to catch Him out. In writing this I do not accuse you of anything other than not being satisfied with my first answer.
It is not a contradiction but rather a paradox, something which happens in life. In the European Union the death penalty is outlawed. The law says clearly you may not kill, but there are circumstances when this cannot stand, e.g. when police officers have to shoot in order to protect others or themselves, or when someone is in danger and fear of their life and no lesser act of self defence is adequate. Again there is no contradiction. However, someone who kills and who is secured by the police may not be judically executed in line with EU law on the outlawing of the death penalty.