"And if not for the bounty of Allah upon you and His mercy, you would have followed Satan, except for a few." The bounty of Allah is Islam, and His mercy is the Quran.
Yahya said: His saying: "You would have followed Satan, except for a few," contains an inversion of order (taqdim wa ta'khir); he says: "Then those who are capable of investigating it would have known it from them, except for a few, and if not for the bounty of Allah upon you and His mercy, you would have followed Satan [except for a few]."
Muhammad said: It is said that this verse was revealed regarding a group of hypocrites and some weak-minded Muslims. When the Prophet—peace be upon him—informed them that he had triumphed over a people, or when a group gathered against whom another group was feared, those hypocrites would spread it about in order to warn those among the disbelievers whom they wished to warn, and to strengthen the hearts of those whom they wished to strengthen. The weak-minded Muslims would spread this along with them, without realizing the harm in doing so. Thus, Allah said: "And if they had referred it to the Messenger," [up to the end of the verse].
﴿وَلَوْلا فَضْلُ اللَّهِ عَلَيْكُمْ وَرَحْمَتُهُ لاتبعتم الشَّيْطَان إِلَّا قَلِيلا﴾ فضل الله الْإِسْلَام، وَرَحمته الْقُرْآن.
قَالَ يحيى: قَوْله: ﴿لاتَّبَعْتُمُ الشَّيْطَانَ إِلَّا قَلِيلا﴾ فِيهِ تَقْدِيم وَتَأْخِير؛ يَقُولُ: لعلمه الَّذين يستنبطونه مِنْهُم إِلَّا قَلِيلا وَلَوْلَا فضل الله عَلَيْكُم وَرَحْمَتُهُ لاتَّبَعْتُمُ الشَّيْطَانَ [إِلا قَلِيلا].
قَالَ مُحَمَّد: قِيلَ: إِن هَذِهِ الْآيَة نزلت فِي جمَاعَة من الْمُنَافِقين، وضعفة من الْمُسلمين؛ كَانُوا إِذا أعلم النَّبِي عليه السلام أَنَّهُ ظَاهر على قوم، أَو إِذَا تجمع قوم يخَاف من جمع مثلهم - أذاع ذَلِكَ المُنَافِقُونَ؛ ليحذر من يحبونَ أَن يحذر من الْكفَّار، وليقوى قلب من يحبونَ أَن يقوى قلبه، وَكَانَ ضعفة الْمُسلمين يشيعون ذَلِكَ مَعَهم من غير علم مِنْهُم بِالضَّرَرِ فِي ذَلِكَ؛ فَقَالَ الله: ﴿وَلَوْ ردُّوهُ إِلَى الرَّسُول﴾ الْآيَة.