Castigation (from the Latin Latin: castigatio) or chastisement (via the French French: châtiment) is the infliction of severe (moral or corporal) punishment. One who administers a castigation is a castigator or chastiser.
In earlier times, castigation specifically meant restoring one to a religiously pure state, called chastity. In ancient Rome, it was also a term for the magistrate called a censor (in the original sense, rather than the later politicized evolution), who castigated in the name of the pagan state religion but with the authority of the 'pious' state.
In Christian times, this terminology was adopted but roughly restricted to the physical sphere: chastity became a matter of approved sexual conduct, castigation usually meaning physical punishment, either as a form of penance, as a voluntary pious exercise (see mortification of the flesh) or as educational or other coercion, while the use for other (e.g. verbal) punishments (and criticism etc.) is now often perceived as metaphorical.
Self-castigation is applied by the repentant culprit to himself, for moral and/or religious reasons, notably as penance.