He said in I‘lām al-Muwaqqi‘īn:
Allah—glorified is He—sets forth two likenesses for the disbelievers: a mirage and layers of darkness. This is because those who turn away from guidance and truth are of two kinds.
The first kind is someone who thinks he has a sound foundation, only to discover otherwise when realities are laid bare. This is the condition of the ignorant and those given to religious innovation and vain desires, who think they possess guidance and knowledge. When realities are laid bare, they discover that they had no sound foundation, and that their beliefs and the deeds based upon them were like a mirage on a barren plain: it appears to the observer as water, yet has no reality. Such too are deeds done for other than Allah and contrary to His command: the person performing them thinks they will benefit him, but they will not. These are the deeds of which Allah, Mighty and Majestic, says:
25:23 “And We will turn to whatever deeds they did and make them scattered dust.”
Consider how Allah—glorified is He—places the mirage on a barren plain: a desolate expanse devoid of buildings, trees, vegetation, and inhabitants. He thus places the mirage in an empty, barren land, while the mirage itself has no reality. This corresponds precisely to their deeds and their hearts, which are barren of faith and guidance.
Consider, too, the meaning contained in His words, “which a thirsty person thinks is water.” This is someone whose thirst has become intense: he sees the mirage, thinks it is water, and pursues it, only to find nothing. Indeed, it fails him when he needs it most. Likewise, because these people’s deeds were not in obedience to the Messenger, may Allah bless him and grant him peace, and were done for other than Allah, they were made like a mirage. They are displayed before them when their thirst and need for them are greatest, yet they find nothing. Instead, they find Allah—glorified is He—there, and He recompenses them for their deeds and settles their account in full.
In the Sahih, Abū Sa‘īd al-Khudrī reports from the Prophet, may Allah bless him and grant him peace, in the hadith concerning Allah’s manifestation on the Day of Resurrection: “Then Hell will be brought forth, appearing like a mirage, and the Jews will be asked, ‘What did you worship?’ They will reply, ‘We used to worship ‘Uzayr, the son of Allah.’ They will be told, ‘You have lied! Allah had neither a consort nor a son. What do you want?’ They will reply, ‘We want You to give us water to drink.’ Then they will be told: