Whatever punishment is chosen, (by whatever method we choose to choose it) will be ineffective unless it is applied evenly. Each time a white guy is acquitted for something a black guy gets locked up for, or a rich kid gets a caution where a poor kid gets time reduces overall confidence in the system.
What constitutes a measured punishment response (and also what the purposes of that punishment are) will change constantly as society's views change, but without confidence that the system will be applied fairly there is not much motive to uphold the law.
In short, even if the law is fair, the punishment is fair, and the purposes understood and agreed upon, the application must also be fair for the system to have confidence and work as intended.
X