I won't repeat what Ms. Klineberg said. The starting point is that assault is an offence. Next, if certain factors are established, the assailant's actions may be defensible.
The premise whereby the assault is an offence is used to deter people, to preserve a certain degree of public order. In no way do you assault anyone, unless it is absolutely necessary. The basic principle is that assaulting anyone must be avoided. If, however, it is necessary, your actions may be defensible, in which case, the circumstances exonerate the assailant.