Legislative and judicial, in a common law system it is usually considered to be judicial discretion or the judge decides this creating a precedent. However parliament or congress can pass laws that include mandatory sentencing this establishing set penalties.