Any judge or magistrate who knowingly issues an unjust sentence or ruling shall be punished as follows:
1. With imprisonment for one to four years if the unjust sentence is against the defendant in a criminal case for a serious or less serious offense and the sentence has not been carried out, and with the same sentence in its upper half and a fine of twelve to twenty-four months if it has been carried out. In both cases, the penalty of absolute disqualification from holding public office for a period of ten to twenty years shall also be imposed.
2. With a fine of six to twelve months and special disqualification from public employment or office for a period of six to ten years if the unjust sentence is against the defendant in proceedings for a minor offense.
3. With a fine of twelve to twenty-four months and special disqualification from public employment or office for a period of ten to twenty years when issuing any other unjust sentence or ruling.