Killing an unbeliever who does not harm the Muslims is corruption that neither Allah nor His Messenger approves.
Likewise, the unbeliever who poses no threat to the Muslims enjoys no inviolability; his life is technically exposed, and he is counted among the fuel of Hellfire. Yet to put him to death without a cause that makes killing lawful is corruption detested by Allah and His Messenger. If he is spared, one may hope that he will embrace Islam, just as one hopes for repentance from sinful Muslims.
Allah, exalted is He, only permitted killing because persecution is worse than killing; He therefore allowed such killing as necessity demands (1). The fundamental principle remains that Allah has forbidden the taking of a soul except with due right (2).
(1) Shaykh al-Islam states in Majmuʿ al-Fatawa, 28/354: “Allah, exalted be He, has permitted the taking of life only to the extent required for the welfare of creation … Whoever does not prevent the Muslims from establishing the religion of Allah bears the harm of his unbelief upon himself alone … For this reason, the Sharia prescribes fighting the unbelievers but does not require killing those of them who are already under Muslim control.”
(2) Shaykh al-Islam likewise says in Majmuʿ al-Fatawa, 16/80: “His words, ‘Wa-idha al-mawʾudatu suʾilat (8) bi-ayyi dhanbin qutilat’—‘and when the girl buried alive is asked (8) for what sin she was killed’ (Q 81:8-9)—show that a life may not be taken except for a sin it has committed; hence it is forbidden to kill a child …”