Al-Hasan said: When Allah revealed what He revealed concerning the Ansarite, he became ashamed to remain among the Muslims, so he joined the polytheists. Consequently, Allah revealed: [And whoever opposes the Messenger] meaning: departs from [after guidance has become clear to him and follows other than the way of the believers] meaning: other than the religion of the believers [We will give him what he has taken].
قَالَ الحَسَن: فَلَمَّا أنزل الله فِي الْأنْصَارِيّ مَا أنزل استحيا أَن يُقيم بَين ظهراني الْمُسلمين، فلحق بالمشركين؛ فَأنْزل الله: ﴿وَمَنْ يُشَاقق الرَّسُول﴾ أَي: يُفَارق ﴿مِنْ بَعْدِ مَا تَبَيَّنَ لَهُ الْهُدَى وَيَتَّبِعْ غَيْرَ سَبِيل الْمُؤمنِينَ﴾ يَعْنِي: غير دين الْمُؤمنِينَ ﴿نُوَلِّهِ مَا تولى﴾