Is the prayer of one who intended to perform تحية المسجد (greeting the mosque) then intended the obligatory prayer in the first rak'ah valid, and is the prayer of one who followed him valid?
It is not permissible to change the intention of a prayer from supererogatory (nafl) to obligatory (fard), because an obligatory prayer requires an intention made concurrently with the Takbirat al-Ihram (opening Allahu Akbar) or slightly before it. Therefore, if the imam changes his intention from supererogatory to obligatory, his prayer will not be valid as an obligatory prayer, but rather will remain supererogatory. As for the prayer of the congregants (ma'mumin), it is valid, because it is permissible for someone praying an obligatory prayer to pray behind someone praying a supererogatory prayer. The prayer of the congregant is not invalidated by the invalidation of the imam's prayer unless there is evidence to support it.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/12552