By Sheikh Khâlid b. Sâlih al-Muwayni`
Abû Qatâdah al-Sulamî relates that Allah’s Messenger (peace be upon him) said: “If one of you enters the mosque, he should not sit down without offering two units of prayer.” [Sahîh al-Bukhârî and Sahîh Muslim]
In another narration from Abû Qatâdah al-Sulamî, relates that he entered the mosque and sat down among the people. Allah’s Messenger (peace be upon him) said to him: “What has prevented you from offering two units of prayer before sitting down?”
Abû al-Qatâdah replied: “O Messenger of Allah, I saw you and everyone else sitting down.
The Prophet (peace be upon him) then said: ““If one of you enters the mosque, he should not sit down without offering two units of prayer.” [Sahîh al-Bukhârî and Sahîh Muslim]
It is a Sunnah to offer two units of prayer as a greeting to the mosque – referred to as tahiyyah al-masjid – regardless of what time you enter the mosque.
Al-Nawawî writes in his commentary on Sahîh Muslim:
This hadîth shows that it is recommended for us to greet the mosque with two units of prayer. Muslims are unanimously agreed that it is Sunnah to do so. Al-Qâdî `Iyâd attributes to Dâwûd (al-Zâhirî) and his followers the opinion that it is obligatory.
The hadîth certainly makes it clear that it is disliked to sit down in the mosque without first offering a prayer. This dislike is only to the level of disapproval. It is merely preferable to offer this prayer.
The hadîth shows that it is preferable to do so whatever time one enters the mosque. This is the ruling adopted by our (Shâfi`î) school of law as well as by a number of other scholars.
Abû Hanîfah and al-Awzâ`î, by contrast, disliked offering this prayer at times when prayer is generally forbidden. Our scholars disagree by saying that the prohibition at those times applies only to prayers that do not have a particular reason for offering them. We see that the Prophet (peace be upon him) made up after `Asr the two-unit Sunnah prayer for Zuhr that he had missed. This is a time when prayers are generally forbidden, so the Prophet’s action narrows down this prohibition to prayers that have no reason preceding them.
In fact, he never left out tahiyyah al-masjid under any circumstances. He even ordered a person to get up and pray who came in the mosque and sat down while he was delivering the Friday sermon. He told the man to get up and offer two units of prayer. This is in spite of the fact that it is forbidden to offer prayers while the sermon is going on – except, that is, for tahiyyah al-masjid.
If there had been any time that tahiyyah al-masjid would have been overlooked, it would have been at this time. The man had already sat down – and tahiyyah al-masjid is supposed to be performed before sitting down – but this man did not know the ruling. The Prophet (peace be upon him) interrupted his sermon to tell the man to get up and pray. If it were not a very important to offer this prayer at all times, the Prophet (peace be upon him) would not have shown so much concern about it.
The hadîth about the Friday sermon that al-Nawawî refers to is as follows:
Jâbir relates that Sulayk al-Ghatafânî came on Friday while Allah’s Messenger (peace be upon him) was delivering the sermon. He sat down. So the Prophet (peace be upon him) said: “Get up and offer two units of prayer, and be brief about it.” Then he said: “If anyone of you arrives on Friday while the imam is delivering the sermon, he should offer two units of prayer, but be brief about it.” [Sahîh al-Bukhârî (1166) and Sahîh Muslim (875) – the version quoted is that of Muslim]
We should understand that it is not necessary to have the express intention of offering a prayer called “tahiyyah al-masjid”. What matters is to follow the hadîth and offer at least two units of prayer before taking a seat in the mosque. It will be enough to offer the Sunnah prayers that one performs before the obligatory prayer. Also, if one commences with the obligatory prayer immediately upon entering the mosque, that will be enough. What is important is not to sit down directly, without offering at least two units of prayer.
Al-Nawawî writes in his commentary:
It is not necessary for the person to have the express intention of offering tahiyyah a-masjid. Any two-unit Sunnah prayer or obligatory prayer will do.
It will not be enough – according to our school of thought – to offer a funeral prayer, a prostration of thanks, or prostration of recitation. Also, it will not be enough to offer a single unit of prayer, even with the intention of greeting the mosque with it. This is because the wording of the hadîth clearly states two units of prayer.
And Allah knows best.