Does the hadith “Whoever prays with the imam until he finishes…” refer to ‘Isha’ or Tarawih?
Question

Many scholars interpret the hadith “Whoever prays with the imam until he finishes, it will be recorded for him as having prayed all night” as referring to Tarawih. How could the Messenger of Allah have said that, when he himself did not lead the Sahabah in praying Tarawih, and did not enjoin them to pray it behind an imam? Rather he went out and prayed on his own in the mosque, and the people gathered behind him for two nights, then he did not come out to them on the third night, and the Sahabah continued to pray it individually, or one man would pray with two others, until the time of ‘Umar. How can we reconcile between the hadith mentioned and what the Prophet (blessings and peace of Allah be upon him) actually did, especially when one of the scholars – perhaps it was as-Suyuti in Sharh at-Tirmidhi – interpreted the hadith as referring to ‘Isha’ prayer and not Tarawih?
Praise be to Allah.The correct view is that this hadith speaks about Tarawih, not the obligatory prayer (‘Isha’).
An-Nasa’i (1364), at-Tirmidhi (806), Abu Dawud (1375) and Ibn Majah (1327) narrated that Abu Dharr said: We fasted Ramadan with the Messenger of Allah (blessings and peace of Allah be upon him) and the Prophet (blessings and peace of Allah be upon him) did not lead us in qiyam until seven nights of the month were left, when he led us in qiyam until nearly one third of the night had gone. Then when six nights were left, he did not lead us in qiyam. Then when five nights were left, he led us in qiyam until nearly half of the night had gone.
We said: O Messenger of Allah, why don’t you do something extra for us and lead us in qiyam all night?
He said: “If a man prays with the imam until he finishes, it will be counted for him as if he spent the entire night in prayer.” Classed as sahih by al-Albani in Sahih an-Nasa’i.
The Prophet (blessings and peace of Allah be upon him) said these words on the second night on which he led his companions (may Allah be pleased with them) in praying qiyam. The reason for that is that they wanted him to lead them in prayer for the rest of the night, so he explained to them that if a person prays qiyam with his imam until he finishes, it will be recorded for him that he spent the whole night in prayer, even if they only prayed qiyam for part of it.
It says in ‘Awn al-Ma‘bud Sharh Abi Dawud (4/174): “Until half of the night had gone” means until halfway through the night. “Why don’t you do something extra for us and lead us in qiyam all night” – and according to one report: for the rest of the night – means: why don’t you make the rest of the night as something extra for us, in addition to the first half?
In an-Nihayah it says: Why don’t you lead us in more nafil (supererogatory) prayers? – They are called nafil (lit. extra) because they are done in addition to the obligatory prayers. Al-Muzhir said: It means: If you lead us in prayer for more than half of the night, that would be better for us. Saying “if” expresses their wish. “Until he finishes” means: until the imam finishes. “It will be counted for him”– in the passive voice – means that it will be taken into consideration and will be counted as qiyam al-layl, meaning that he will attain the reward of having spent the whole night in prayer. In other words, this reward is attained by merely offering the obligatory prayer, and the nafil (supererogatory prayer) is connected to one’s level of energy, because Allah does not get tired, but you get tired. It says in al-Mirqat: The apparent meaning indicates that what is meant by the obligatory prayer is ‘Isha’ and Fajr. End quote.
With regard to those who interpret the hadith as referring to ‘Isha’ prayer, this view is not obvious, because it is based on the famous hadith of ‘Uthman, which says that whoever prays ‘Isha’ in congregation, it is as if he spent half the night in prayer, and whoever prays Fajr in congregation, it is as if he spent the entire night in prayer. Narrated by Muslim.
This refers to the virtue of a different prayer, and has nothing to do with the hadith under discussion here. Therefore he [the one who held this view] needed to refer to Fajr prayer, even though it is not mentioned in this hadith, so that he could convey the meaning that he wanted to convey, which is attaining the virtue of spending the entire night in prayer, because that cannot be attained by praying ‘Isha’ only.
The apparent meaning of the hadith is clear, which is that the amount of qiyam that they prayed with the imam – which was half of the night – is equivalent to spending the entire night in prayer. That is a virtue that may be attained by the one who prays with his imam until he finishes.
As-Sindi said in al-Hashiyah ‘ala Ibn Majah (1/398): at-Tahhawi said in Sharh al-Athar: It was quoted as evidence by those who say that praying qiyam in Ramadan with the imam is better.
And those who disagreed with him quoted as evidence the hadith: “The best prayer a man can offer is in his house, except the obligatory prayers.” He said that to them when he led them in praying  qiyam al-layl in Ramadan in his mosque, and he wanted to lead them again after that, so he told them that their praying in their houses on their own was better than their praying with him in his mosque, so how about praying with another imam in another mosque?
The response regarding this hadith is: it may be that by praying qiyam with the imam for part of the night, a person may get the reward of spending the whole night in prayer, and his praying qiyam in his house is better than that, so there is no contradiction between the two matters. End quote.
Ibn Raslan said in Sharh Abi Dawud (6/623): If a man prays with the imam until he finishes, he will be granted the reward of spending the whole night in prayer (qiyam al-layl). According to the version narrated by an-Nasa’i: “Whoever prays qiyam al-layl with the imam until he finishes, Allah will record it for him as qiyam al-layl (spending the night in prayer).” According to the version narrated by Ibn Majah: “It is equivalent to qiyam al-layl (spending the night in prayer).”
It is most likely that this virtue has to do with praying qiyam al-layl in Ramadan, because the Prophet’s words – “If a man prays with the imam” were in response to their question: “why don’t you do something extra for us and lead us in qiyam all night?” So the answer matches the question, which has to do with the supererogatory prayer of qiyam al-layl.
This is also indicated by the Prophet’s words: “If he prays with the imam until he finishes,” as he mentioned praying with the imam. Moreover, the preposition (hatta – until) indicates praying with the imam until he finishes.
This indicates that this virtue is only attained in the case of prayers in which the people follow the imam, which is not applicable in the case of the regular obligatory prayers.
It is possible that this virtue is applicable to the obligatory prayers, as it says in a report narrated by Abu Dawud and at-Tirmidhi from ‘Uthman: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “Whoever prays ‘Isha’ and Fajr in congregation, it will be like spending the night in prayer (qiyam al-layl).” This indicates that if someone prays both of these prayers with the imam, it will be recorded for him as if he spent the night in prayer. The correct view, according to the Shafa‘is and others, is that praying in congregation is attained even if there is an imam and only one person who follows him in prayer. End quote.
What reinforces the view that this hadith is about Tarawih, not about the obligatory prayer, is the fact that in the case of the obligatory prayer, a person has no choice whether to leave or stay.
Abu’l-Hasan al-Mubarakfuri said in Mirqat al-Mafatih (4/318): With regard to the hadith of ‘Uthman which was referred to by al-Qari, it may be said regarding its meaning that whoever offers the obligatory prayers of ‘Isha’ and Fajr with the imam – meaning in congregation – will have the reward of spending the entire night in prayer, which is akin to the reward of offering the obligatory prayers. Here it may be said that if he prays Tarawih with the imam until he finishes, he will have the reward of spending the entire night in prayer and the reward of offering a supererogatory prayer. It was said: and this is supported by the report narrated by at-Tirmidhi, an-Nasa’i and Ibn Majah with the wording “Whoever prays qiyam with the imam” instead of “if he prays with the imam.” The word qiyam clearly refers to the (supererogatory) night prayers, namely Tarawih. This is also supported by the fact that Abu Dharr asked the Prophet (blessings and peace of Allah be upon him) to do something extra and lead them in prayer for the rest of the night, and the Prophet’s response implies that there was no need to spend the rest of the night in prayer, because the reward of spending the entire night in prayer had been attained by the prayers in which he had led them (qiyam al-layl).
It is also supported by the Prophet’s words “until he [the imam] leaves, because this indicates that leaving before the imam has finished all of his prayers is possible, whereas it is well-known that leaving during the obligatory prayer is not possible, because the worshipper cannot leave until after the imam has finished. This is in contrast to Tarawih, during which it is possible to leave before the imam has finished, because the prayers are offered two [rak‘ahs] by two, so it is possible for a man to leave before the imam has finished the entire Tarawih prayer. End quote.
Conclusion:
This reward and virtue clearly refers to Tarawih prayer, and this does not contradict the fact that a similar reward may also be attained by the one who prays ‘Isha’ and Fajr in congregation.
And Allah knows best.