Positive commandment · Mitzvat Aseh #224 of 613
To whip the wicked
להלקות הרשעים
The verse · Devarim 25:2
וְהָיָה אִם־בִּן הַכּוֹת הָרָשָׁע וְהִפִּילוֹ הַשֹּׁפֵט וְהִכָּהוּ לְפָנָיו כְּדֵי רִשְׁעָתוֹ בְּמִסְפָּר
“And it shall be, if the wicked man be worthy to be beaten, that the judge shall cause him to lie down, and he shall be beaten in his presence, according to his fault, by a certain number.”
The Rambam’s words
To whip the wicked, as [Deuteronomy 25:2] states: "The judge will cast him down and beat him."
להלקות הרשעים, שנאמר: "והפילו השופט והכהו" (דברים כה,ב).
Why · Sefer HaChinuch #594
Lash the evildoer
“It is from the roots of the commandment [that] since Israel are called the children of the Omnipresent, He, may He be blessed, wanted to discipline them for their sins, so that they return to Him and, in the end, merit the world that is completely good — and like the matter that is written (Proverbs 19:18), “Discipline your son while there is still hope, and do not set your heart on his destruction.””
Who & when
“And this commandment is practiced in the Land of Israel, which has an ordained court.”
Where in the Mishneh Torah
Hilchot The Sanhedrin and the Penalties within Their Jurisdiction הלכות סנהדרין והעונשין המסורין להם