If, while performing a fard or nafl prayer, a person sits for tashahhud and gives salam at the end of any rak'ah before the final one, mistakenly thinking it is the last rak'ah, and if they have not done anything that invalidates the prayer—such as turning their chest away from the qibla, speaking, or laughing—they should immediately stand up and complete the remaining rak'ahs. At the end of the prayer, they should perform the prostration of forgetfulness (sujood as-sahw); in this way, their prayer will be complete. However, if after giving salam without completing the missed rak'ahs, they do something that invalidates the prayer, they must start the prayer over from the beginning. (Marghinani, al-Hidaya, 1/76; Ibn Nujaym, al-Bahr, 1/311; Ibn Abidin, Radd al-Muhtar, 2/91-92)
Source: T.C. Diyanet İşleri Başkanlığı, Din İşleri Yüksek Kurulu
This content was drafted with AI assistance and reviewed by an editor.