If you are in doubt, the doubt is on the fourth rakah because you are certain that you have prayed three but doubting the fourth one. In this case, pray the fourth as it is the doubtful one.

If I’m uncertain for example in salah that whether I’m on 3rd rakat or fourth rakat. Islam says to skip 3rd rakat because I should not pay attention to doubts after being certain about something. But Islam also says to pray 3rd rakat so I could go with what I’m certain about. Could you please tell me which way is correct?

Prayer |