1272. If a person deliberately adds or omits any of the obligatory components of prayer, be it even one letter, his prayer will be deemed invalid.
1273. If a person adds or omits one of the components of prayer out of ignorance, and he is a culpable ignorant, his prayer will be invalid. However, if he is an excusable ignorant, or if he forgetfully adds or omits an obligatory component that is not a rukn, his prayer will be valid. As for obligatory components that are rukn, their rulings have been elaborated in article 951.
If a person recites sÙrat al-FÁtiÎah or the second sÙrah with a low voice in the fajr, maghrib or ishÁ prayers, or recites them aloud in the Ûuhr or ‘aÒr prayers, or while travelling he prays the Ûuhr, ‘aÒr or ishÁ prayers in four rak‘ah, out of ignorance (in all these cases), his prayers will be valid, though he be a culpable ignorant
1274. If during prayer, or after it, a person realizes that his wuÃÙ or ghusl was invalid, or he realizes that he engaged in prayer without performing wuÃÙ or ghusl, his prayer will be invalid. He should repeat his prayer with wuÃÙ or ghusl, or if its time has elapsed, offer its qaÃÁ.
1275. If a person remembers after reaching the rukÙ, that he forgetfully omitted the two sujÙd of the preceding rak‘ah, his prayer will be invalid. However, if he realizes prior to reaching the rukÙ, he should return and perform the two sujÙd. Thereafter he should stand and recite sÙrat al-FÁtiÎah and the second sÙrah, or recite tasbÐÎÁt al-arba‘ah, and complete his prayer. He should then, as dictated by obligatory precaution, offer two sajdat al-sahw for the additional qirÁÞah or tasbÐÎÁt. Recommended precaution dictates that he should also offer two sajdat al-sahw for the inopportune standing.
1276. If prior to reciting (السَّلامُ عَلَيْنَا وَ عَلي عِبادِ اللهِ الصَّالِحين) or (السَّلامُ عَليْكُمْ وَ رَحْمَةُ اللهِ وَ بَرَكاتُهُ), a person realizes that he did not perform the two sujÙd of the last rak‘ah, he should perform them, and then repeat the tashahhud and recite the salÁm. Obligatory precaution dictates that he should offer two sajdat al-sahw for the additional tashahhud.
1277. If prior to the salÁm, a person realizes that he omitted one or more of the last rak‘ah(s) of prayer, he should perform the rak‘ahs that he had forgotten.
1278. If a person realizes after the salÁm of prayer, that he omitted one or more of the last rak‘ah(s) of prayer, and has also performed an act that would invalidate prayer, whether performed inadvertently or deliberately, such as turning his back to the qiblah, his prayer will be invalid. However, if he did not carry out such an act, he should immediately perform the rak‘ah(s) that he forgetfully omitted. Obligatory precaution dictates that he should offer two sajdat al-sahw for the additional salÁm, and another two sajdat al-sahw if had performed an additional tashahhud.
1279. If after the salÁm, a person performs an act that would invalidate prayers, whether performed inadvertently or deliberately, such as turning his back to the qiblah, and later realizes that he had omitted the last two sujÙd of prayer, his prayer will be invalid. However, if he realizes it prior to performing an act that would invalidate his prayer, he should perform the two forgotten sujÙd, and repeat the tashahhud and the salÁm. Obligatory precaution dictates that he should offer two sajdat al-sahw for the inopportune salÁm, and another two sajdat al-sahw for the additional tashahhud.
1280. If a person realizes that he had offered the entire prayer prior its prescribed time, he should repeat it. If its time has elapsed, he should offer its qaÃÁ. However, if he offered some of it prior to its prescribed time, its ruling has been elaborated in article 751.
If a person realizes that he was not facing the qiblah, his prayer will be deemed valid if the deviation from the qiblah was between the left and right side. However, if the deviation was greater than this, he should repeat his prayer if he realizes it within its prescribed time. If he realizes after its prescribed time, he is not obligated to offer its qaÃÁ, unless he had his back to the qiblah, in which case, obligatory precaution dictates that he offer its qaÃÁ.
In all of the above cases, if a person was facing a direction other than the qiblah due to his ignorance of the sharia ruling, his prayer will be deemed invalid.