Section: It is a condition for the validity of congregational prayer (jama'ah) that both the imam and the follower (ma'mum) intend their respective roles; the imam must intend that he is an imam, and the follower must intend that he is a follower. If two men pray, and each of them intends that he is the imam of his companion or a follower to him, their prayer is invalid. This was explicitly stated by him [Ahmad], because in the first scenario, he followed one who is not acting as an imam, and in the second, he led one who did not intend to follow him. If a man sees two men praying and intends to follow the follower, it is not valid, because he followed one who did not intend to lead him. [If he intends to follow one of them without specifying which, it is not valid until he specifies the imam, because specifying him is a condition] (39). If he intends to follow both of them together, it is not valid, because he intended to follow one who is not acting as an imam, and because he intended to follow two individuals, and it is not permissible to follow more than one. If he intends to follow two imams, it is not permitted, because it is impossible to follow them both simultaneously.
Section: If a person begins prayer alone, then another person arrives and prays with him, and he [the first person] intends to lead him, it is valid in supererogatory (nafl) prayer. Ahmad stated this explicitly. He cited the hadith of Ibn 'Abbas, which is that Ibn 'Abbas said: "I spent the night with my aunt Maymunah. The Prophet (peace and blessings of Allah be upon him) stood up to pray a voluntary prayer at night. He went to a water skin, performed ablution, then stood up and prayed. I stood up when I saw him doing that, performed ablution from the water skin, then stood on his left side. He took my hand from behind his back and moved me like that to his right side." Agreed upon (40). This is the wording of Muslim's narration. As for obligatory (fard) prayer, if he is waiting for someone—like the imam of a mosque who begins his prayer alone and waits for whoever arrives to pray with him—then this is also permissible. Ahmad stated this explicitly, because the Prophet (peace and blessings of Allah be upon him) began his prayer alone, then Jabir and Jabbar (41) arrived and joined him, so he led them in prayer and did not disapprove of their action (42). The outward appearance is that it was an obligatory prayer, because they were travelers. If it were not so, it has been narrated from Ahmad...
(39) Omitted from [manuscript] A. (40) Its takhrij (authentication/sourcing) has preceded on page 51. (41) In [manuscripts] A and M: "wa Jabbarah"—this is an error. (42) It has preceded on page 53.