Thus, if a person forgets the prayer itself, he must perform it when he remembers it; there is no expiation for it other than that. The same applies if he forgets the purification required for it, as when the Prophet commanded the man who had left a small patch on his foot untouched by water to repeat his ablution and prayer. Likewise, if he forgets a rak‘ah, as in the hadith of Dhū al-Yadayn, he must perform what he forgot, either by adding it to what he has already prayed or by beginning the prayer anew.
These, then, are five authentic hadiths, in all of which he commands the person who forgets to perform the two prostrations of forgetfulness. When he inadvertently omitted the first tashahhud, he led the Muslims in performing these two prostrations before the salām. When he ended the prayer with the salām after two or three rak‘ahs, he prayed what remained and led the Muslims in performing the two prostrations after the prayer. When they reminded him that he had prayed five rak‘ahs, he performed the two prostrations after having said the salām and spoken.
This indicates that he consistently performed these two prostrations and emphasized their importance, and that he never omitted them when an instance of forgetfulness called for them. These are clear, evident proofs that they are obligatory. This is the position of the majority of scholars and the school of Mālik, Ahmad and Abū Hanīfah. Those who do not consider them obligatory have no evidence approaching this in strength.
Al-Shāfi‘ī did not consider them obligatory only because, in his view, there is no obligatory act within the prayer whose omission leaves the prayer valid, whether omitted deliberately or inadvertently. The majority of scholars—the three imams and others—hold that some obligatory acts of prayer may be omitted without invalidating it. However, Mālik, Ahmad and others say that deliberately omitting such an act invalidates the prayer and requires it to be repeated, whereas omitting it inadvertently requires the prostrations of forgetfulness.
Abū Hanīfah says:
If he omits it deliberately, he has acted wrongly