The scholars differed concerning the relationship between a person’s prayer and the prayer of the imam. There are three opinions:
(i)That there is no connection between them and each person is praying on his own account. This is the prevailing view among the Shafaa‘is.
(ii)That it is connected to the imam’s prayer and stems from it, so any fault that affects the imam’s prayer will affect the prayer of the one who is praying behind him. This is the view of Abu Haneefah and is narrated in one report from Ahmad.
(iii)That it is connected to the imam’s prayer, but it only affects the prayer of the one who is praying behind him when there is no excuse on the part of either of them. But if there is an excuse, a defect in the imam’s prayer does not affect the prayer of the one who is praying behind him. If the imam believes that he has wudoo’, then he is excused for leading the people in prayer and the one who is praying behind him is excused for following him in prayer. This is the view of Maalik, Ahmad and others and this is what could be understood from the report narrated from the Sahaabah concerning this issue. And this is the soundest approach.
Majmoo‘ al-Fataawa by Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him), 23/370-371
Thus the prayer of one who is praying behind an imam is not necessarily invalidated as soon as the imam’s prayer becomes invalidated, because if the one who is praying behind him does his prayer properly, fulfilling all its conditions and doing all of its essential and obligatory parts, it is not permissible to regard it as invalid except with sound evidence. This is indicated by the report narrated by al-Bukhaari (694) and Ahmad (8449) from Abu Hurayrah (may Allah be pleased with him), according to which the Messenger of Allah (blessings and peace of Allah be upon him) said: “They lead you in prayer; if they do it properly then it is for you and for them, but if they make a mistake then it is for you and against them.”
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said:
Ibn al-Mundhir said: This hadeeth refutes those who say that if the prayer of the imam is rendered invalid, the prayer of those praying behind him is also rendered invalid. End quote.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
This is a text which shows that if the imam makes a mistake it is his responsibility and not that of those who are praying behind him. End quote.
Majmoo‘ al-Fataawa, 23/372
Al-Sa‘di (may Allah have mercy on him) said:
The correct view is that the prayer of the one who is praying behind an imam is not rendered invalid in all cases if the prayer of his imam becomes invalid, even if the imam’s prayer became invalid during the prayer and he exited it. The one who is praying behind the imam may carry on with his prayer, either on his own, or one of them may lead them in the rest of the prayer. This is a strong report from Imam Ahmad. End quote.
al-Fataawa al-Sa‘diyyah, 7/120
Based on that, if the prayer of the imam became invalid for some reason which has nothing to do with the prayer of the one who is praying behind him, then the prayer of the latter is not rendered invalid, such as if the imam prayed without wudoo’ by mistake, or he lost his wudoo’ during the prayer.
There are some cases in which the prayer of the one who is praying behind the imam does become invalid if the prayer of the imam is rendered invalid. For example:
-If the imam’s prayer becomes invalid for an obvious reason that could not be hidden from those who are praying behind him, and they continue following him in prayer, such as if he did not face the qiblah or cover his ‘awrah, or he failed to say takbeerat al-ihram (the opening takbeer) or to recite al-Faatihah in a prayer in which Qur’aan is to be recited out loud.
Ibn Qudaamah (may Allah have mercy on him) said: If other conditions are not met by the imam, such as covering (his ‘awrah) and facing the qiblah, the one who is praying behind him cannot be excused, because such things usually cannot be hidden, unlike minor impurity (losing one’s wudoo’) and najaasah (impurity, i.e., on his clothes). End quote.
The prayer of the imam and the one who is following him is rendered invalid if there passes between the imam and his sutrah anything that interrupts the prayer, such as a woman, a donkey or a black dog. If a woman walks in between the imam and his sutrah, his prayer is rendered invalid, as is the prayer of those who are praying behind him, because the sutrah of the imam is the sutrah of those who are praying behind him, as the Prophet (blessings and peace of Allah be upon him) said: “When one of you stands to pray, he will be screened if he has something in front of him that is like the back of a saddle. If he does not have something in front of him that is like the back of a saddle, then his prayer will be interrupted if a donkey, a woman or a black dog passes in front of him.” Narrated by Muslim, 510.
See also the answer to question no. 3404.
And Allah knows best.