8:27
يَٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُوا۟ لَا تَخُونُوا۟ ٱللَّهَ وَٱلرَّسُولَ وَتَخُونُوٓا۟ أَمَٰنَٰتِكُمْ وَأَنتُمْ تَعْلَمُونَ
O you who have believed, do not betray Allah and the Messenger or betray your trusts while you know [the consequence].
Translation · Saheeh International
Tafsir
Ibn Kathīr (abridged)
Reason behind revealing This Ayah, and the prohibition of Betrayal
The Two Sahihs mention the story of Hatib bin Abi Balta`ah. In the year of the victory of Makkah he wrote to the Quraysh alerting them that the Messenger of Allah ﷺ intended to march towards them. Allah informed His Messenger of this, and he sent a Companion to retrieve the letter that Hatib sent, and then he summoned him. He admitted to what he did. `Umar bin Al-Khattab stood up and said, "O Allah's Messenger! Should I cut off his head, for he has betrayed Allah, His Messenger and the believers" The Prophet said,
«دَعْهُ فَإِنَّهُ قَدْ شَهِدَ بَدْرًا، وَمَا يُدْرِيكَ لَعَلَّ اللهَ اطَّلَعَ عَلَى أَهْلِ بَدْرٍ فَقَالَ: اعْمَلُوا مَا شِئْتُمْ فَقَدْ غَفَرْتُ لَكُم»
(Leave him! He participated in Badr. How do you know that Allah has not looked at those who participated in Badr and said, Do whatever you want, for I have forgiven you.)
However, it appears that this Ayah is more general, even if it was revealed about a specific incident. Such rulings are dealt with by their indications, not the specific reasons behind revealing them, according to the majority of scholars.
Betrayal includes both minor and major sins, as well those that affect others. `Ali bin Abi Talhah said that Ibn `Abbas commented on the Ayah,