Is the prayer valid if the worshiper doubts during the first rak'ah whether it is the first or the second, then becomes certain after the prayer that it was indeed the first rak'ah?
Whoever doubts the number of Rak'ahs during their prayer should build upon the lesser number, complete their prayer, and perform the prostration of forgetfulness (Sujud al-Sahw), based on the Prophet's (peace be upon him) saying: "If one of you doubts in his prayer and does not know how many he has prayed, three or four, let him cast away doubt and build upon what he is certain of, then prostrate twice." What you did, by building upon the greater number, is incorrect, especially since it became clear to you later. You must repeat the prayer because concluding the prayer with Tasleem before verifying its completion is among the things that invalidate the prayer.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/42168