Deuteronomy 25:1-3

Corporal punishment

1 Now two people have a disagreement and they enter into litigation and their case is decided, with the judges declaring one person legally right and the other legally liable.
2 If the guilty party is to be beaten, the presiding judge will have that person lie down and be punished in his presence—the number of blows in measure with the guilt determined.
3 Give no more than forty blows. If more than that is given, your fellow Israelite would be completely disgraced in your eyes.