A group of individuals sitting in a court room completely uneffected by the actions of the human they are sentencing to death are not under threat by that person. They are not protecting themselves. They are bureaucratically murdering another human that has not transgressed against them.
It is moral for a human to kill another human if that human is protecting his/her life or someone elses' life against direct transgression. Likewise, it is moral for a group of people to kill in the same manner.