33. The verse is open to application to anyone who befriends an evil man who prevents him from taking the path of the Prophet, although, perhaps the first to whom it was applicable was `Uqba b. Abi Mu`ayt. He took Ubayy b. Khalf as his friend to denounce the Prophet after declaring faith in him, to be thus led into apostasy and blasphemy by an unkindly friend (Ibn Jarir, Kashshaf, Qurtubi, Ibn Kathir).
A Muslim should be, cautions Shafi, careful about whom he befriends. The Prophet has said in a report preserved by Bukhari, “A man is on the religion of his friend. So, let him see whom he befriends.” And, as Qurtubi cited, someone asked the Prophet, “Which of our acquaintances are the best?” He answered, “He who reminds you of Allah as you see him, who increases your knowledge when he talks, and whose deeds remind you of the Hereafter.”
Haythami has said that the above Hadith is in Abu Ya`la which has Mubarak b. Hassan as one of the narrators, who has been trusted by some, while the other narrators are those of the Sahih works.
Shafi` also quotes a Hadith in Ahmed, Tirmidhi and Abu Da’ud which says, “Accept not the company but that of a believer and let not your food be partaken but by a pious person.” (This Hadith does not mean that the impious should not be invited to food, but rather, as scholars have explained, it means one shouldn’t get too close to them to be eating and drinking with them (Au.).
Qurtubi also writes: (The Prophet has instructed us about having the right type of friends). He said according to a narration preserved by Muslim, “The example of a good companion and an evil companion is like the carrier of musk and the blower in the bagpipe (the ironsmith). As for the carrier of musk, either he will gift you some or one might buy some from him. Or, in the least, you will find fragrance with him. As for the blower into the bagpipe, either he will burn your clothes or you will get from him an evil smell.” Malik b. Dinar has said, “That you haul stones in the company of the pious is better than that you should eat victuals in the company of the impious.”