The Messenger of Allah (ﷺ) said: "Whoever has doubt during his prayer, let him prostrate twice after he said the taslim."
The Book of Forgetfulness (In Prayer)
Sunan an-Nasa'i - Hadith Reference: Sunan an-Nasa'i 1249
Hadith Text
The Messenger of Allah (ﷺ) said: "Whoever has doubt during his prayer, let him prostrate twice after he said the taslim."
Commentary (Sharh)
This noble hadith establishes the remedy for uncertainty that occurs during the prayer. The prostration mentioned here refers to the prostrations of forgetfulness (sujud al-sahw), which are two prostrations performed before or after the taslim depending on the circumstance.
When a worshipper experiences doubt about the number of rak'ahs performed - whether they have prayed three or four, for instance - they should base their action on what they are certain of, complete the prayer accordingly, then perform the taslim, and afterward prostrate twice for forgetfulness.
This ruling demonstrates the mercy and facilitation in Islamic legislation, as it provides a simple means to rectify errors in prayer without invalidating the entire worship. The wisdom behind performing these prostrations after taslim in cases of doubt is to distinguish them from the regular prostrations of prayer and to complete what may have been omitted due to uncertainty.
Scholars have noted that this hadith applies specifically to cases where one cannot determine with certainty which alternative is correct. If one can ascertain the correct number through reflection, they should act upon that certainty instead.