Of the words, deeds and beliefs that are unique to the Sufis and have no basis in the Book of Allaah and the Sunnah of His Prophet (peace and blessings of Allaah be upon him), some are bid’ahs (innovations) that constitute kufr, and some are bid’ahs that do not constitute kufr. If this imam follows bid’ahs that constitute kufr, you should not pray behind him. If he follows bid’ahs that do not constitute kufr, then it is permissible to pray behind him although someone else who is a follower of ahl al-sunnah would undoubtedly be better.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him) said:
If I come to a village where the imam is a sufi who does not hold one hand over the other when praying, and he does not go down on his knees before his hands when prostrating, is it permissible to pray with him?
If he is known to believe in Tawheed and not shirk, and he is only a little ignorant or follows a few ideas of Sufism (tasawwuf), but he is a believer in Tawheed and a Muslim who worships Allaah alone and does not worship Shaykhs or any other created being, such as Shaykh ‘Abd al-Qaadir etc, and the only problem is that he does not hold one hand over the other when praying, then there is no reason not to pray behind him, because this is something that is Sunnah, not obligatory. Holding one hand over the other means placing the right hand over the left hand, wrist and forearm over the chest when standing in prayer. The one who lets his arms hang by his sides is not doing anything wrong and his prayer is valid. …
Fataawa al-Shaykh Ibn Baaz (12/120, 121).
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him) was also asked:
What is the ruling on praying behind someone who goes to the graves of righteous people to seek blessing from them and to recite Qur'aan on the Mawlids and other occasions in return for payment?
This is subject to further discussion. If he merely celebrates the Mawlid without any shirk involved, then he is an innovator and he should not be an imam, because it is proven in the saheeh hadeeth that the Prophet (peace and blessings of Allaah be upon him) said: “Beware of newly-invented matters because every newly invented matter is an innovation (bid’ah) and every innovation is a going astray.” Narrated by Abu Dawood (3991). And celebrating the Mawlid (Prophet’s birthday) is an innovation. But if he prays to the dead and seeks help from them or from the jinn or other created beings, and he says “O Messenger of Allaah help me or heal my sick loved one” or he says “Ya Sayyidi al-Husayn” or “Ya Sayyidi al-Badawi” or calls upon any other dead person, or prays to inanimate things such as idols, saying “al-madad al-madad (help, help)”, then he is a mushrik who is guilty of major shirk, and you should not pray behind him and his leading the prayers is not valid. We ask Allaah to keep us safe and sound.
But if he commits bid’ah such as attending the Mawlid but he does not do any act of shirk, or he reads Qur’aan beside graves, or he prays at the graves, but he does not do any act of shirk, then he has introduced innovation into the religion, so he should be taught and directed towards what is good, but his prayer is valid if he does not pray by the graves. As for his prayers in the graveyard, they are not valid, because the Prophet (peace and blessings of Allaah be upon him) said: “May Allaah curse the Jews and the Christians, for they have taken the graves of their Prophets as places of worship.” Agreed upon.
Fataawa al-Shaykh Ibn Baaz (9/373, 374 and 12/108, 109).