The man confessed, and told people what he was going to do before the event, so this isn't the case here. Though I agree with your argument, and that's the reason I don't think a government -should- have the power to do something like this. But the question asked was "Is this a fair punishment?", not "Is this a good way to run a country?"
The answer to "Is it a fair punishment?" is yes.