jihad cannot be undertaken except through action that leads to their deaths, there are two opinions.
Those who permit this say that killing them for the executioner’s benefit is like the killing of Muslim combatants, who become martyrs. Similar examples include imposing the prescribed punishment on al-mabādhil, fighting rebels, and other such cases. Another example is permitting marriage to a slave woman for fear of falling into sin. This, too, is a broad subject.
As for the fourth category, an example is eating carrion when suffering extreme hunger. Eating in this situation is a good and obligatory act that cannot be accomplished except through this evil, and its benefit outweighs its harm. Foul remedies represent the reverse case: their harm outweighs the therapeutic benefit they offer, because other remedies can serve the same purpose and because recovery through them is uncertain. The same applies to drinking wine as medicine.
It is thus clear that an evil is tolerated in two situations: to avert something worse when it cannot otherwise be averted, and to secure a benefit greater than that of avoiding the evil when that benefit cannot otherwise be secured. A good act is likewise relinquished in two situations: when it causes something better to be lost, or when it necessarily entails an evil whose harm exceeds the benefit of the good act.
This concerns the weighing of religious benefits and harms. As for waiving an obligation because of worldly harm, or permitting something forbidden because of a worldly need—such as waiving fasting because of travel, and lifting the restrictions of ihrām (pilgrimage consecration)