An aggressor is warded off with the minimum amount of force required, if possible. If it is possible to ward him off by shouting and crying for help, he is not warded off by using one's hands. If one cannot ward him off with one’s hands, one wards him off by using a stick. If one cannot ward him off using a stick, one wards him off using a weapon. If he cannot be warded off except by injuring a limb, one does so, and if he cannot be warded off except by killing, one wards him off by killing him. In other words, if it is possible to ward him off by talking and crying for help, it is unlawful to strike. If one can strike with a whip, it is unlawful to strike with a stick. If one can chop off a limb, it is unlawful to kill. If one can run away, then the position of the madhhab is that it is obligatory to do so, and it is unlawful to fight.
[Translated from al-Fiqh ash-Shāfiʿī al-Muyassar by Imam Wahbah az-Zuḥaylī (Damascus: Dār al-Fikr, 2008) v.2, p.444]
 (tn): i.e. if one has to resort to more extreme measures, then one does so. As Imam Ahmad ibn Naqīb al-Maṣrī says in the same section in ʿUmdat as-Sālik, ‘If one is convinced that the aggressor cannot be warded off except by killing him, one kills him and one is not held accountable for doing so.’ [Tanwīr al-Masālik bi Sharḥ wa Adillat ʿUmdat as-Sālik wa ʿUddat an-Nāsik (Damascus: Dār al-Muṣṭafā, 1431/2010), v.2, p.961] Sheikh Muṣṭafā al-Bughā and his co-authors also explain, ‘If the one being aggressed against becomes aware of the aggressor while he is carrying out a crime, such as committing al-fāḥishah [i.e. rape] or killing an innocent person, one can kill him directly without resorting to any preliminary measures. If one kills the aggressor in a situation like this, the aggressor’s life is not protected by law.’ [al-Fiqh al-Manhajī ʿalā Madhhab al-Imām ash-Shāfiʿī (Damascus: Dār al-Qalam, 1433/2012) v.3, p.454]
 (tn): i.e. the legal school of Imam Muḥammad ibn Idrīs ash-Shāfiʿī