Bayhaqi 5111 — Chapters on the imam and follower having different
Chapters on the imam and follower having different intentions and other matters -- Chapter: The obligatory prayer behind one praying a voluntary prayer
جماع أبواب اختلاف نية الإمام والمأموم وغير ذلك -- باب: الفريضة خلف من يصلي النافلة
A man said to Tawus (may Allah have mercy on him): "I found the people standing in the night prayer, so I made it my Isha prayer." He said: "You did right."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5111