Greeting the mosque

A person who enters the mosque in a state of purity intending to sit should first pray two rakahs, as the Prophet ﷺ instructed in Abu Qatadah’s hadith. The majority regard them as recommended. If the obligatory congregational prayer has begun, the person joins it; prayer on entering has thereby been fulfilled. Likewise, someone who enters and prays, for example, the regular Sunnah before Dhuhr before sitting has fulfilled the greeting according to scholars.

Entering after Asr brings out the disagreement over voluntary prayers with a specific cause. Shafiis permit greeting the mosque then because its cause preceded it, while other schools restrict voluntary prayer at this time. The distinction is discussed in the section on restricted times.

Al-Nawawi, al-Majmu, chapter on voluntary prayer, greeting the mosque. Ibn Qudamah, al-Mughni, chapter on the times when prayer is prohibited.