This is another article in the chapter Enormities from the classical manual on Sharia called Reliance of the Traveller. The articles are posted one by one in the order they are given in the book.
p74.0 SPYING ON THE MUSLIMS AND REVEALING THEIR WEAKNESSES
p74.1 Included in this subject is the hadith of Hatib ibn Abi Balta’a (A: who sent a secret letter telling of the Muslims’ military plans to his relatives in Mecca in hopes that they would not get hurt) whom ‘Umar (Allah be well pleased with him) wanted to kill for what he had done, but the Prophet (Allah bless him and give him peace) forbade ‘Umar to, as Hatib had fought at Badr (A: and by accepting Hatib’s excuse, left nothing for any Muslim to criticize (dis: p75.3).
If someone’s spying entails undermining Islam and its people, or the killing, captivity, enslavement, or plundering of the Muslims, or . anything of the like, then he is one of those who strive for corruption in the land, destroying tillage and offspring, and he is subject to death. And deserves the torment (A: of hellfire), may Allah save us from it. Anyone who spies necessarily knows that if ordinary talebearing is an enormity (dis: p45), a spy’s carrying information is far more abominable and heinous.