Yosef Karo, Shulchan Aruch — Choshen Mishpat 27
“ If one deserves a nidui because he treated the court with disrespect, but the court wants to waive their honor and not put a nidui on him, they may do so, so long as it will not cause a loss in the honor of Hashem, such as a case where the people would treat the honor of Torah and judges lightly, in which case we would need to punish as is appropriate since the people were lax in this matter. ”
