The beis din has an obligation to administer the penalty of whiplashes for violating certain laws. Lashes were given in multiples of three and the maximum number of lashes that might be given was 39. One-third of the lashes were administered on the convicted offender’s front and two-thirds on his back.
The reason for this mitzvah was to penalize the sinner in this world so that he should change his ways and still merit a desirable afterlife. For this reason, the offender was examined to determine how many lashes he should be able to endure, since accidentally killing him would be counter productive. (Since lashes were given in multiples of three, if one was judged to be able to withstand 20 lashes, he was given 18, not 21.) If the one being lashed seems unable to endure his punishment, or if he soiled himself, the whiplashes were stopped.
Lashes could be given by a beis din of three judges (as opposed to a larger court of 23). However, the members of the beis din needed to have the original semicha (ordination) in order to have the authority to impose this penalty.
This mitzvah only applies in Israel at at time of the original ordination. It is discussed in the Talmud in the tractates of Makkos (22a-23b) and Kesubos (35a-b). This mitzvah is codified in the Mishneh Torah in the sixteenth chapter of Hilchos Sanhedrin and is #224 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos.