﴿1﴾ يَا أَيُّهَا الَّذِينَ آمَنُوا لاَ تَتَّخِذُوا عَدُوِّي وَعَدُوَّكُمْ أَوْلِيَاءَ تُلْقُونَ إِلَيْهِم بِالْمَوَدَّةِ وَقَدْ كَفَرُوْا بِمَا جَاءَكُم مِنَ الْحَقِّ يُخْرِجُونَ الرَّسُولَ وَإِيَّاكُمْ أَن تُؤْمِنُوا بِاللَّهِ رَبِّكُمْ إِن كُنتُم خَرَجْتُمْ جِهَاداً فِي سَبِيلي وَابْتِغَاءَ مَرْضَاتِي تُسِرُّونَ إِلَيْهِم بِالْمَوَدَّةِ وَأَنَا أَعْلَمُ بِمَا أَخْفَيْتُمْ وَمَا أَعْلَنتُمْ وَمَن يَفْعَلْهُ مِنكُمْ فَقَدْ ضَلَّ سَوَاءَ السَّبِيلِ
1. O you who believe! Take not My enemies and your enemies as friends. You befriend them while they have disbelieved in what has come to you of the Truth. Besides they have driven out the Messenger and yourselves [from Mecca] since you believe in Allah, your Lord! If you have come forth to strive in My Cause and to seek My Good Pleasure [, do not befriend them]. You show friendship to them in secret while I am All-Aware of what you conceal and what you reveal. And whoever of you does that, then verily he has gone astray from the Straight Path.
Occasion of Revelation. The majority of Qur’anic exegetes have explicitly mentioned that the blessed Verse concerns Hātib ibn Abī Bulta‘a. In his Majma‘ al-Bayān, Tabarsī narrates that a certain woman by the name of Sāra, from a Meccan tribe, departing from Mecca for Median, came unto Allah's Messenger (SAW). The Noble Prophet (SAW) asked her whether she had converted to the Islamic faith and had come there. She provided a negative reply. Upon being asked by the Noble Prophet as to the reason lying behind her departure, she replied: "We were descended from you. Now
that all my guardians have departed, I have been severely rendered in need. I have come here so that you may provide me with clothes and a mount." The Noble Prophet (SAW) asked inquired: "What happened to the Meccan youth?" The question alluded to her profession as a vocalist performing for the youth." She replied that following the battle of Badr, no one had asked her to perform on the vocals. The response reflects the severity of the polytheists' defeat at the battle of Badr. Thus, the Noble Prophet (SAW) ordered the children of ‘Abd al-Muttalib to provide her with clothes, a mount, and some money for her travel. The Noble Prophet (SAW) was preparing himself for the conquest of Mecca at the time when Hātib ibn Abī Bulta‘a, a Muslim of fame who had participated at the battle of Badr and the Ridwān Pledge (Bay‘a) came unto Sāra. He wrote a letter and asked her to hand it to the people of Mecca. He also provided her with ten dinars and some brocade. In his letter, Hātib had informed the people of Mecca that Allah's Messenger intended to confront them and had asked them to prepare themselves for defending themselves. Sāra took the letter and headed for Mecca.
Upon being apprised of the story by Gabriel, the Noble Prophet (SAW) ordered Hadrat ‘Alī (as), ‘Ammār Numayr, Zubayr, Talha, Miqdād, and Abū Marthad to mount and head for Mecca. He told them that they would meet with a woman en route who would carry a letter from Hātib to Meccan polytheists. They were ordered to seize the letter. Upon meeting with her, she denied carrying such letter and swore to the same. They searched her luggage, but they failed to find it. Therefore, they made up their mind to return, but Hadrat ‘Alī drew his sword saying: "Neither the Messenger (SAW) nor we forge lies. Produce the letter, or else I will behead you." Appreciating the seriousness of the issue, she took out the letter from her hair." The letter was taken to the Noble Prophet (SAW).
Having summoned Hātib, the Noble Prophet (SAW) asked him: "Do you recognize the letter?" He replied: "Yes." He inquired: "Why did you send the letter?" He answered: "O Allah's Messenger (SAW)! Since the day on which I converted to the Islamic faith, I have neither disbelieved for a single moment, nor have I betrayed you, nor have I accepted the polytheist's invitation from whom I have separated, but the point is that all Emigrants know people in Mecca who support their families against the polytheists and I am a stranger here and my family are their captives. I intended to curry their favor to ward off harm to my family. However, I was aware that God Almighty would cause their defeat and my letter would do them no god. The Noble Prophet (SAW) accepted his excuse, but ‘Umar rose up asking Allah's Messenger to allow him to behead the hypocrite. The Noble Prophet (SAW) said that he was one of the warriors fighting at the Battle of Badr and God Almighty favored them. Then the blessed Verses in question were revealed and provided Muslims with significant lessons regarding refraining befriending the polytheists and Allah's enemies. 
The society of believers should not befriend Allah's enemies. It was mentioned in the occasion of the Revelation of the blessed Verses in question that a Muslim without intending espionage expressed his favor for the enemies of the Islamic faith as a consequence of which the blessed Verses was revealed to warn Muslims not to embark upon such measures. The blessed Verse opens by addressing the believers saying that Allah's and your enemies are not to be befriended, since they are Allah's and your own enemies. The blessed Verse proceeds to say that you express your affection for them whereas they disbelieve what has been revealed unto
 The report has been narrated in sources, e.g. Ma‘ma‘ al-Bayān, Bukhārī's Sahīh, Rūh al-Bayān, Fī Âalāl al-Qur’an and the exegetic works by Qurtubī and Marāghī.
you of Truth, namely the Islamic faith and the Holy Qur’an. They drive you and Allah's Messenger (SAW) out of your homelands. They are against your beliefs and confront you regarding your greatest glory, i.e. belief in God Almighty as your gravest sin and crime as a consequence of which you have been driven out of your homeland by them. Thus, it would not be befitting had you expressed your affection toward them. It is incumbent upon you to strive beside the mighty army of Muslim warriors to liberate them from Divine Retribution.
The blessed Verse further expounds that if you have emigrated from your homeland to wage jihad in Divine Cause and Satisfaction, you are not supposed to establish friendly ties with them. If you truly claim to be Allah's friends, having emigrated from your homeland in His Cause, seeking to wage jihad in His Cause and for His Good Pleasure, God Almighty is All-Aware of your overt and covert intentions and it would be useless to keep secrets from the Omniscient Lord Who is All-Aware of the seen and the unseen. The blessed Verse closes with a decisive warning to the effect that whoever from amongst you befriends Allah's and your enemies, he has indeed gone astray in that he has deviated from the Straight Path imagining that he may keep something secret from God Almighty and he has also gone astray from the path of faith, devotion, and fear of God Almighty.