ذَلِكَ بِأَنَّهُمُ اتَّبَعُوا مَا أَسْخَطَ اللَّهَ وَكَرِهُوا رِضْوَانَهُ فَأَحْبَطَ أَعْمَالَهُمْ
[47:28]
That is because they follow what is displeasing to Allah and are averse to His pleasure, therefore He has made null their deeds.
This because they followed that which called forth the Wrath of Allah, and they hated Allah's good pleasure; so He made their deeds of no effect.
That will be because they followed that which angereth Allah, and hated that which pleaseth Him. Therefor He hath made their actions vain.