if he dies in that state, his deeds are rendered void by scholarly consensus, as the Quran explicitly states in several places. For example, Allah says:
“Whoever among you turns back from his religion and dies as a disbeliever—their deeds are rendered void in this world and the Hereafter.”
And He says:
“Whoever rejects faith, his deeds are rendered void.”
And He says:
“Had they associated others with Allah, all that they used to do would have been rendered void.”
And He says:
“If you associate others with Allah, your deeds will surely be rendered void.”
However, scholars have differed concerning someone who apostatizes and then returns to Islam: are the deeds he performed before his apostasy rendered void, or are they rendered void only if he dies an apostate? There are two well-known views, both of which are held within the school of Imam Ahmad. The view that the deeds are rendered void is that of Abū Hanīfah and Mālik, while the view that their nullification remains in suspense is that of al-Shāfiʿī.
People have also differed concerning the apostate: should it be said that he had sound faith which his apostasy rendered void? Or should it instead be said that his apostasy revealed to us that his faith had been unsound, and that sound faith can never disappear? Different groups hold these two views.
On this rests the question concerning someone who qualifies his statement by saying, “I am a believer—if Allah wills”: does this qualification refer to the completeness of faith, or to the state in which one ultimately meets one’s end? Allah knows best.