And that which we prefer is: whenever the imam has a forgetfulness, and the one behind him has missed part of the prayer, he should stand and complete [his missed rak'ahs], then prostrate; that is more beloved to us, so that the imam does not perform the salutation for himself deliberately—or for his forgetfulness—while those behind him have not yet performed their obligatory duty, thus inserting a Sunnah in the middle of their obligation.
He said: "And if he prostrates them [the two prostrations] with the imam then performs what he missed, we hope that it is permissible, for that is what a number of the Tabi'in did."
1016 - Muhammad ibn al-Wazir narrated to us, saying: al-Walid ibn Muslim narrated to us, saying: Salim informed me, saying: I heard al-Hasan say—regarding a man who caught part of the prayer with the imam, and missed part of it, and the imam forgot during what he missed; should the imam prostrate for the two prostrations of forgetfulness? He said: "He should prostrate with the imam for the two prostrations of forgetfulness, then perform what he missed afterwards."
1017 - Al-Walid said: I mentioned that to Abu 'Amr, so he said: "If the imam prostrates for his forgetfulness before his salutation from the prayer, he should prostrate with him, then stand and perform what he missed. And if the imam prostrates after his salutation, he should perform what he missed, then prostrate the two prostrations of forgetfulness following the prostration of his imam."
Chapter: Regarding one who rises during the two rak'ahs without sitting for the tashahhud
• I said to Ahmad: The man rises during the two rak'ahs? He said: "If he remembers before he stands erect, he should sit. If he stands erect, he should continue with his prayer; and if he sits, there is no harm, but standing is stronger."
1018 - Ahmad ibn Hanbal narrated to us, saying: Isma'il ibn Ibrahim narrated to us, saying: Ibn 'Awn narrated to us, from al-Sha'bi, who said: "Al-Nu'man ibn Bashir prayed with us, and when he was in the two rak'ahs—where he intended to sit—he rose, so they glorified him, and he sat. When he finished, he prostrated two prostrations, and we prostrated with him."
(1) Perhaps the word "sahw" (forgetfulness) is omitted here. (2) Perhaps the word "ma'a" (with) is omitted here, or the correct reading is "fasajada" (so he prostrated).