Is what was done correct: doubting the number of rak'ahs (one or two) during the last tashahhud, then performing the prostration of forgetfulness (sujud al-sahw) before the salutation (taslim), and then repeating the prayer thereafter?
You made a mistake by not building upon the minimum in the first prayer and sufficing with the prostration of forgetfulness, as your prayer was not complete. What was obligatory upon you was to build upon certainty, which is the minimum, then to perform the rest of the prayer, then to perform the prostration of forgetfulness. For the Prophet, peace and blessings be upon him, said: "Let him cast away doubt and build upon what he is certain of, then let him prostrate twice before giving the salutation."
Your repetition of the second prayer was correct, but mending and correcting the prayer is better than cutting it off and repeating it, because it is the Sunnah of the Prophet, peace and blessings be upon him, and the righteous predecessors. Imam Al-Qarafi said: "Drawing closer to Allah Almighty through a mended, restored prayer, if doubt arises therein, is better than turning away from mending it, or starting a different one."
A Muslim must learn the rulings of purification and prayer and what rectifies them, so that he may worship Allah with insight.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/189951