Imam Al-Nawawi's Riyad-us-Saliheen
Chapter 211
The Desirability of Prostrating out of Gratitude

1159. Sa`d bin Abu Waqqas (May Allah be pleased with him) reported: We left Makkah with the Messenger of Allah (sallallaahu ’alayhi wa sallam) for Al-Madinah, and when we were near `Azwara,' he (sallallaahu ’alayhi wa sallam) alighted (from his riding-camel) raised his hands in supplication to Allah for a while and prostrated himself. He remained for a long time in prostration. Then he stood up and raised his hands for a while, after which he prostrated himself (again), and remained for a long time in prostration. Then he stood up and raised his hands for a while, after which he prostrated himself for the third time. Then he (sallallaahu ’alayhi wa sallam) said, "I supplicated my Rubb and made intercession for my Ummah, and He granted me one-third of them. So I again prostrated myself in gratitude to my Rubb. Then I raised my head and supplicated my Rubb for my Ummah, and He granted me another third of them. Again I raised my head and supplicated my Rubb for my Ummah and He granted me the last third of them. So I fell into prostration out of gratitude before my Rubb.''
[Abu Dawud].

Commentary: The phrase "I supplicated my Rubb and made intercession for my Ummah'' means that the Prophet (sallallaahu ’alayhi wa sallam) prayed to Allah to pardon his Ummah and to admit them to Jannah. The interpretation of this Hadith is stated to be that ultimately all the Muslims will be sent to Jannah. They will not abide in Hell for ever. Some of them will go to Jannah after suffering the punishment for their major sins, some through the intercession of the Prophet (sallallaahu ’alayhi wa sallam), and some by the Special Grace of Allah. This interpretation is no doubt true. This is confirmed by other Ahadith and forms the belief of the followers of Sunnah of the Prophet (sallallaahu ’alayhi wa sallam). But the Hadith under discussion is not "Sahih''. However, Sujud-ush-Shukr (prostrations for thanksgiving), in support of which Imam An-Nawawi has reproduced this Hadith here, is also proved by other Ahadith. To prostrate in gratitude to Allah is correct and permissible . The incident of K`ab bin Malik is included in Sahih Bukhari and Sahih Muslim, which shows that after he came to know that his repentance was accepted, he prostrated to give thanks to Allah. According to the Shafi`i school of thought, the basic elements of Sujud-ush-Shukr (or prostrations to express thanks to Allah) are: (a) the intention (in the heart), (b) the Takbir, (c) prostration and (d) Taslim; the Hanafi school of thought, however, maintain that it is an act of prostration between two Takbir. It is permissible to perform it outside Salat, but not during it because it will invalidate it, if one does so deliberately.