Question: A teacher of young boys cannot complete their instruction in the required manner except by beating. Is it permissible to beat them for that purpose?
Answer: It is not permissible to beat a child without the permission of his guardian. However, the teacher is deemed outwardly to have permission, and this permission is inferred from the indication of the situation. Yet even with this inferred permission, it is not permissible for the teacher to beat the boy except after the failure of other means, which are enticing (towards good), frightening (from evil), praise, encouragement, and the like. It is necessary to restrict the beating to what there is no avoiding, and the teacher must not exceed what is customary of beating. The more the beating is lessened and reduced, the better, as a precaution against falling into what is forbidden.
Source: Min Thimār al-ʿIlm wa al-Ḥikmah vol.2