The 8th Amendment blocks “excessive” and “cruel and unusual” punishment at the highest level of government in the US.
More generally, jurisdictions often have sentencing guidelines and minimum and maximum sentencing laws that a judge must operate within.
Should they violate this, the sentencing will be overturned on appeal. If this happens repeatedly the judge will likely lose their next retaining election, and may risk more personal sanctions, penalties, and disbarment for breaking the law themselves.
Latest Answers