The ruling on a prayer in which a wajib act was omitted
Question
A person omitted a wajib act in prayer and performed the sajda [of forgetfulness] after turning for the salam. The wajib was missed within the prayer, so why did he perform the sajda al-sahw after the prayer? Is his prayer valid?
Answer
Even if someone missed a rak‘a and forgetfully turned for the salam, then remembered right away, stood up, completed the prayer and performed the sajda al-sahw, the prayer is still valid. This is stated in “Shami” and other books of fiqh.
Source: Fatawa Mahmudiyya
Preview. The full text opens with JavaScript enabled.