I was offering the Maghrib (Sunset) Prayer behind the Imam (the one who leads congregational Prayer). After saying the last Tashahhud (testification recited in the sitting position in the last unit of Prayer), he rose up and offered a fourth Rak`ah (unit of Prayer). We said, 'Subhana Allah' (Glorified be Allah) but he pointed to us to stand up. So we stood up and offered the fourth Rak`ah. After Taslim (salutation of peace ending the Prayer), we asked him if he recited Surah Al-Fatihah in the third Rak`ah and he replied in the affirmative but added that he mistakenly offered the extra Rak`ah. What should we do? Is our Salah (Prayer) Batil (null and void)? What should those who came late and missed one Rak`ah do?
those who were certain that the Imam added a fourth Rak`ah should have remained sitting down and not follow the Imam in adding another Rak`ah. Those who were doubtful should follow him; and all the Ma'mums (persons being led by an Imam in Prayer) should perform Sujud-ul-Sahw (Prostration of Forgetfulness) with the Imam in all cases. They are excused due to their ignorance, and their Salah is correct.
those who missed a Rak`ah and followed the Imam should not consider the extra Rak`ah in which they followed the Imam. They should offer a Rak`ah (Part No. 7; Page No. 138) after the Imam says the Taslim.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.