Congregational Prayer and Its Virtue
Man Lā Yaḥḍuruh al-Faqīh|Volume 1|Book 1|Chapter 57
وَ إِنَّ عَلِيّاً عَلَيْهِ اَلسَّلاَمُ قَالَ: فِي رَجُلَيْنِ اِخْتَلَفَا فَقَالَ أَحَدُهُمَا كُنْتُ إِمَامَكَ وَقَالَ اَلْآخَرُ كُنْتُ إِمَامَكَ قَالَ «صَلاَتُهُمَا تَامَّةٌ» قَالَ قُلْتُ فَإِنْ قَالَ أَحَدُهُمَا كُنْتُ أَئْتَمُّ بِكَ وَقَالَ اَلْآخَرُ كُنْتُ أَئْتَمُّ بِكَ قَالَ «فَصَلاَتُهُمَا فَاسِدَةٌ فَلْيَسْتَأْنِفَا.
Imam Ali عليه السلام said regarding two men who disagreed, with one saying, "I was your Imam (leader in prayer)," and the other saying, "I was your Imam," that "their prayers are valid." When asked what if one of them said: "I was following you (as the Imam)," and the other also said: "I was following you," Imam عليه السلام said: "Then their prayers are invalid, and they must repeat the prayer”.
- Ṣaḥīḥ al-Faqīh