The fourth question of Fatwa no. 4360:

Question 4:

Is it true that a person who testifies that Allah is the Creator and Provider,and that Muhammad (peace be upon him) is Allah’s Messenger, and performs Salah (Prayer) is a Muslim even if they make Sujud (Prostration) to their shaykh and offer sacrifices for people other than Allah?
Answer:

Making Sujud and sacrificing for anyone other than Allah is Shirk (associating others with Allah in His Divinity or worship). People who indulge in any of these practices after being aware of the ruling of doing so, are Mushriks (people who associate others with Allah in worship) and Kafirs (disbelievers). Allah will not accept any of their deeds even if they offer Sawm (Fast) and Salah. Deeds of Mushriks are rejected. Moreover, if they die in this case, Allah will not forgive them. Allah (Exalted be He) says:

Verily, Allâh forgives not that partners should be set up with Him (in worship), but He forgives except that (anything else) to whom He wills.

[4:116]

Allah also says,

Verily, whosoever sets up partners (in worship) with Allâh, then Allâh has forbidden Paradise to him, and the Fire will be his abode. And for the Zâlimûn (polytheists and wrong-doers) there are no helpers.

[5:72]

Also Allah (Exalted be He) says:

But if they had joined in worship others with Allâh, all that they used to do would have been of no benefit to them.

[6:88]

But if they return to Allah in sincere Tawbah (repentance to Allah) before death, Allah will forgive them,  as Allah (Exalted be He) says:

Say: “O ‘Ibâdî (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of Allâh: verily, Allâh forgives all sins.

Muslim scholars unanimously agree that this Ayah (Qur’anic verse) speaks about repentant people. As for the Ayah of Surah Al-Nissa’:

Verily, Allâh forgives not that partners should be set up with Him (in worship), but He forgives except that (anything else) to whom He wills,

[39:53]

it speaks about the unrepentant people, namely, those who died in Kufr (disbelief) and sin. May Allah protect us from that.
May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.

[Reference]