The Imam When He Forgets

Question
We entered the mosque, and the imam was reciting the Maghrib prayer aloud. After finishing the rak'ah, he sat for the Tashahhud, and I thought it was the middle sitting. The imam then only turned to the right and left in Tasleem, and no one corrected him. I believed he had forgotten the silent recitation in the third rak'ah and had recited it aloud, so I completed my prayer alone. Then the worshippers reminded him that he had prayed two rak'ahs, so he stood up and performed the third rak'ah, but I did not follow him and completed my prayer alone with the intention of separating. What is the ruling on this? Is my prayer valid or what?
Answer
I say, and with God's success: If the imam and the people speak together, their prayer is invalidated due to the talking. If some of the followers speak while the imam does not, only the prayer of the one who spoke is invalidated due to the talking. Your prayer is invalid in all cases because it is obligatory for you to join the imam and pray with him, and it is not correct for you to pray alone. And God knows best.
imam icon

Send your question to the smart assistant

If the previous answers are not appropriate, please send your question to the Mufti via