47-Surah Muhammad 28
That is because they followed what angered Allah and disliked [what earns] His pleasure, so He rendered worthless their deeds.
ذَٰلِكَ بِأَنَّهُمُ اتَّبَعُوا مَا أَسْخَطَ اللَّهَ وَكَرِهُوا رِضْوَانَهُ فَأَحْبَطَ أَعْمَالَهُمْ
Quran's Tafhim ( explanation)
*38) This refers to alI those works that they performed as "Muslims." Their Prayers, their fasting, their payments of the zakat, and all other acts of worship and virtue, which in appearance and form are counted among good works. were rendered void, for they failed to adopt the attitude of sincerity and loyalty towards AIIah and Islam and the Muslim community even though they professed to be Muslims; but, on the contrary, they went on conspiring with the enemies of Islam for the sake of small worldly gains, and started devising schemes to save themselves from any possible risks as soon as time came for Jihad in the cause of AIIah. These verses are absolutely decisive and conclusive in this regard that in the conflict between Islam and un-Islam the faith of the person whose sympathies are not with Islam and the Muslims, or are with disbelief and the disbelievers, cannot at aII be reliable, not to speak of any of his works being acceptable before AIIah.