“But for those who deny the truth, their deeds are like a mirage in the desert which the thirsty supposes to be water until he comes to it only to find that it was nothing; instead he found Allah with him and then Allah settled his account in full. Allah is swift in settling the account.” (Al-Qur’ān -24:39)
‘Those who deny the truth’ deliberately decided against accepting the Message which they had received through Prophet Muhammad (peace and blessings of Allah be to him). The parable of a mirage relates to those who, despite their disbelief and hypocrisy, do some apparently good deeds and appear to believe in the Hereafter. At the same time these people mistakenly think that even without their sincerely believing, without cultivating the attributes of true believers, and without obeying and following the Messenger of God, their good deeds will benefit them in the Hereafter. Here, they are being told that such an expectation is no more than a mirage. A thirsty person traversing a desert is taken in by the mirage and mistakenly believes it to be a spring, and frantically pursues it so as to quench his thirst.
However, on reaching the spot he discovers that the place has no water. In the same manner, when these hypocrites die and find themselves in the Next World, they will realize that none of their deeds will benefit them. On the contrary, God will take full account of their unbelief, their hypocrisy, and their misdeeds which just happened to be accompanied by a few good deeds.