Assalamu'alykum warohmatulloh wabarokatuh. Some people started observing solatul Magbrib before the sun sets in a masjid I was present but I didn't join them as the appointed time of the solat has not reached. But before the congregation finished the solat, the sun had set and I joined the congregation as the appointed time of the solatul maghrib has now entered. Is my prayer valid since I joined this congregation and what is the validity of the prayer of the rest of the congregation who started before the appointed time of the solat? Jazakumullohu Khair
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Beginning an obligatory prayer before its time invalidates it. It is not permissible to do that deliberately. Allah Says (what means): {Indeed, prayer has been decreed upon the believers a decree of specified times.} [Quran 4:103]
That is a specified time during which it must be performed after its beginning and before its expiry. Therefore, the prayer of people who started the Maghrib prayer before sunset is considered invalid, and they must repeat it. Even if what preceded sunset was just the Takbeeratul-Ihram (first Takbeer when starting the prayer).
Al-Fawakih ad-Dawani Sharh Risalat Ibn Abu Zaid al-Maliki reads: “If the worshiper begins to say the Takbeer before the Zawal (beginning of the time of noon when the sun passes the meridian [this is the beginning of time of Dhuhr]) appears, then the Zawal appears after the Takbeer or during it, the Thuhr prayer is not valid.” [End of quote]
This applies to all times and prayers. Therefore, initiating a prayer before ensuring that its time has started is not valid. But if he was ignorant and did not know, his prayer becomes supererogatory and he is obliged to repeat it.
Regarding your prayer with this Imam and the congregation who started the prayer before the beginning of its time, it is invalid because you knew of their mistake and the invalidity of their prayer. You must repeat it as the scholars stated that whoever follows an Imam knowing his prayer is invalid, his prayer is also invalid for his lack of an excuse.
Majmoo’ Al-Fatawa by Sheikh Al-Islam Ibn Taymiyyah reads: “It takes place with the prayer of the Imam, but the deficiency extends to the prayer of the follower with no excuse from both of them. As for those with an excuse, the deficiency does not apply.”
For more benefit on the ruling on congregation's prayer when the Imam’s prayer is invalid, please refer to Fatwa 319732.
Allah knows best.
You can search for fatwa through many choices