Deuteronomy 25:2

then it shall be, if the wicked man deserves to be beaten, that the judge will cause him to lie down and be beaten in his presence, according to his guilt, with a certain number of blows.