In the Stranger, we see Meursault having little to no emotion at his mom's funeral which makes him seem strange but then see him mindlessly agreeing to things without really thinking and finally see him murder a man. The murder is the most severe and after he shoots once, he pauses and shoots again four more times. There was no reason for the shots except for the sun which doesn't really add up as a reason to kill someone. All these events that take place, lead the court to question his morality and his soul. This is eventually what leads them to decide that he is a danger to people and is the reason why they must kill him.
Based on Meursault explanation during the kill, he seems to be responding to the sun in his kill and not to the Arab man. He then goes through the court case honest but not really saying much about what happened because their were no thoughts around why he shot the extra 4 times. I think its interesting because even after they sentenced him to death, he still didn't seem overly upset. He also has a girlfriend Marie who comes to visit him while he is in jail and is a witness to him in court. She asked him if he loved her before the murder and he said it doesn't really matter but no, and then continued in the relationship with her. After he was sentenced to execution he says, "Anyway, after that, remembering Marie meant nothing to me. (pg. 115) This quote proves how he doesn't care about people and thinks everything in life is meaningless which relates back to the killing of how he had no thoughts or emotions about the Arab, he killed.
All the events discussed above lead me to my final point; should he have been sentenced to death or prison? Well based on what we know he has killed a man with excessive shots for no apparent reason. He doesn't have morals and agrees with whatever other people tell him. For example Raymond beats his mistress after he thinks he cheats and then he asks Meursault to testify in his defense in court and Meursault's says sure. Meursault also seems to feel little emotional connection to people like in Marie and Maman's case, we see very little emotions to either of them. These instances don't necessary warrant death but possibly life in prison because he seems to have moral issues but doesn't seem like he wants to go out and shoot and kill everyone. I don't know if he is necessarily dangerous but could have a mental illness such as anxiety which is why he would feel hot so often and feel the need to run from it. I think that Meursault didn't deserve execution because of his motives but he does seem a bit uncontrollable because of how he responds when hot (or panicked). Also we in America have a different view of the death penalty than Algers in that time period did. This could lead to why they choose death penalty over life imprisonment. All in all I think Meursault is safe in the house where he can be calm but if he is out without supervision he runs into large self-control issues. The walk on the beach is like the second time we see him fully alone without many people. The rest of the time he usually has someone with him or nearby and if he did something they might be able to stop him.
*spoiler!