It is Makruh to pray behind deviants. However, it is not permitted to consider everyone who differs with one to be a deviant. And it is certainly deplorable to be sectarian.
عَنْ عَائِشَةَ رَضِيَ اللَّهُ عَنْهَا، قَالَتْ: قَالَ رَسُولُ اللَّهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ: «مَنْ أَحْدَثَ فِي أَمْرِنَا هَذَا مَا لَيْسَ فِيهِ، فَهُوَ رَدٌّ»
(Sayidah) Aishah (May Allah Most High be pleased with her), said that the Messenger of Allah ﷺ said, “Whoever innovates something into this affair of ours, which is not in it, then it is rejected.” (Sahih al-Bukhari, 2697).
There is a strict prohibition on religious innovation (Bid’ah) in Islam. Therefore a person involved in such innovation is not to be given any form of religious authority, as that would lead to an opportunity to spread the Bid’ah. Thus, such a person should not be put forward as an Imam.
وكره إمامة العبد والأعرابيّ والفاسق والمبتدع. (كنز الدقائق)
It is Makruh for a slave, Bedouin, brazen sinner or innovator to be an Imam. (Imam al- Nasafi, Kanz al-Daqaiq).
والفاسق والمبتدع في إمامتهما تعظيمُهما، وقد أمرنا بإهانتهما. (فتح باب العناية بشرح النقاية)
And (it is Makruh for) a brazen sinner or innovator (to be Imam), because making them Imam is revering them and we have been commanded to undermine them. (Imam Ali al-Qari, Fath Bab al-Inayah).
“والمبتدع” بارتكابه ما أحدث على خلاف الحق المتلقى عن رسول الله صلى الله عليه وسلم. (مراقي الفلاح شرح متن نور الإيضاح)
And (it is Makruh for) an innovator (to be Imam). Due to his involvement in introducing something against the truth (Haqq), which has been received from the Messenger of Allah (peace be upon him). (Imam al-Shurunbulali, Maraaqi al-Falah).
In the Nusoos below, we find major classical scholars of the Hanafi Madhab explaining the fact that it is Makruh to pray behind an innovator, nonetheless the prayer will be legally valid so long as the innovation is not so extreme that it leads to Kufr. Having said this, it is necessary to point out that other factors are important to consider when speaking of the validity of praying behind a particular Imam. For example, his ability to recite the Holy Quran correctly (without major mistakes in Tajweed) and to perform a valid prayer based on Fiqh rulings. Sometimes people are happy to pray behind a particular Imam because they are confident he is not an innovator, but they pay no attention to his Tajweed, this is a clear error.
وَجُمْلَتُهُ أَنَّ مَنْ كَانَ مِنْ أَهْلِ قِبْلَتِنَا وَلَمْ يَغُلَّ حَتَّى لَمْ يُحْكَمْ بِكُفْرِهِ تَجُوزُ الصَّلَاةُ خَلْفَهُ، وَتُكْرَهُ، وَلَا تَجُوزُ الصَّلَاةُ خَلْفَ مُنْكِرِ الشَّفَاعَةِ وَالرُّؤْيَةِ وَعَذَابِ الْقَبْرِ وَالْكِرَامِ الْكَاتِبِينَ لِأَنَّهُ كَافِرٌ. (فتح القدير)
In summary, whoever is amongst the people of our Qiblah (Muslim) and has not gone so far astray that he is to be considered a Kafir, it is permitted (valid) to pray behind him. However it is Makruh. Nonetheless, it is not permitted to pray behind someone who rejects the intercession, the (beatific) vision, punishment of the grave or the noble recording angels because that is Kufr. (Imam Ibn Humaam, Fath al-Qadeer).
وفي ” المجتبى ” و” المبسوط “: يكره الاقتداء بصاحب البدعة. (البناية شرح الهداية)
And in al-Mujtaba and al-Mabsoot is states, it is Makruh to pray behind an innovator. (Imam al-Ayni, al-Binayah).
ويصح الاقتداء بأهل الأهواء إلا الجمهية والقدرية والرافضي الغالي ومن يقول بخلق القرآن وفي بعض الروايات إلا الخطابية وكذا المشبهة لا تجوز الصلاة خلفهم أما من سواهم يجوز الاقتداء بهم ويكره وكذا الاقتداء بمن كان معروفاً بأكل الربا والفسق مروي ذلك عن أبي حنيفة و أبي يوسف رحمهما الله تعالى. (فتاوى قاضيخان)
And it is valid to pray behind people of desire (innovation), except for al-Jahmiyyah, al-Qadariyyah, an extreme Rafidi or someone who considers the Quran to be created. And in some narrations al-Khattabiyah and likewise the anthropomorphist. Prayer is not permitted behind them. As for other than them, it is permitted to pray behind them but it is Makruh. And likewise, someone who is known to consume usury, or know for brazen sin. This has been narrated from Abu Hanifah and Abu Yusuf, May Allah Most High have mercy upon them. (Imam Qadi Khan, Fatawaa Qadi Khan).
So, as we see from the Nusoos (texts) of the Madhab, it is certainly Makruh to pray behind deviants. However, the issue in our communities is that people use this ruling for sectarian purposes. Many people have affiliated themselves with recently established groups, and moved away from the classical, agreed upon, authoritative scholars of Ahl Sunnah. Such people tend to attack other similar groups, and often look to the mainstream with suspicion. They deem themselves to be on the truth alone.
People of such a sectarian mindset will cause widespread division in the Ummah, and they deem it unacceptable to pray behind people that the majority of Muslims will consider to be part of Ahl Sunnah. However, such groups tend to harbour great enmity for one another and deem it absolutely impermissible to pray behind another. Please watch the video below for more details on this issue.
And Allah Most High Knows Best.
– Answered by Shaykh Noorud-deen Rashid (20.12.2021)
Do Ash’ari scholars prefer intellect over Quran and Hadith?
See also (video):