‘Abdullāh b. Buraydah narrated from his father, may God be pleased with him: “The Messenger of God, peace be upon him, was delivering a sermon when Ḥasan and Ḥusayn came forward, wearing red shirts, stumbling and getting back up. The Prophet, peace be upon him, stepped down, picked them up, and carried them with him back to the pulpit. He then said: “God has spoken the truth. ‘Your wealth and your children are only a trial.’ I saw these two and could not be patient. He then resumed his sermon.” (Sunan Abī Dawūd)
In another narration it is recorded that the Messenger of God, peace be upon him, was praying. When he prostrated Ḥasan and Ḥusayn would climb on his back and when someone tried to prevent them from doing so, he gestured to let them be. When he completed his prayer he placed them both on his lap. (Ṣaḥīḥ Ibn Khuzaymah)
Muslim reported on the authority of al-Rabīʿ b. Muʿawidh, may God be pleased with her, who said: “The Messenger of God, peace be upon him, sent on the morning of ‘Āshūrā to the villages of the Anṣār around Madīnah the following message: ‘Whoever woke up fasting should complete his fast, and whoever had breakfast should complete the rest of the day without food.’ The Companions said, ‘We henceforth observed fast on it and, God willing, made our children observe it as well. We would go to the mosque and make toys out of wool for them and when they cried from hunger would distract them with these toys until it was time to break the fast.’”
Bukhārī and Muslim both reported on the authority of ʿĀʾishah, may God be pleased with her, that the Messenger of God, peace be upon him, deferred ʿIshāʾ prayer, also referred to as the ʿAtamah prayer, one night. The Messenger of God, peace be upon him, did not come out until ‘Umar b. Khaṭṭāb said that the women and children had gone to sleep [waiting for the prayer in the mosque]. So the Messenger of God, peace be upon him, came out towards them and said to the people of the mosque: “Know that you are the only people in the world waiting for it (the prayer),” as it was before spread of Islam.
They said: Some of our Imāms and teachers in our mosques assured us that children did not used to come to the mosque. Their mothers would leave them at home and the sound of their crying would reach the Prophet, peace be upon, while he was praying in the mosque, and he would therefore shorten his prayer.
I replied: That is an absurd and far-fetched interpretation. Do they not see that the grandchildren of the Prophet, peace be upon him, Ḥasan, Ḥusayn, and Umāmah were present in the mosque? Did they not read the ḥadīth of ʿĀʾishah, may God be pleased with her, that the women and children would sleep in the mosque while waiting for the ʿIshāʾ prayer?
They said: Perhaps this specific sunnah stopped being practiced in later generations?
I replied: No, this sunnah continued to be practiced. The strongest evidence of this is the fact that children continued to be recorded as present during the audition of readings of Islamic texts [samāʿ]. These auditions were held in mosques and would also be attended by Imāms, jurists, and judges. They would have prevented children from being present had they considered their presence detested.
They said: Some of them use as evidence the ḥadīth: “Keep your children and insane ones away from the mosques,” to support their claim that children should be kicked out of the mosque.
I replied: This ḥadīth is not only weak but denounced [munkar] and should not be used as evidence. Both al-Bazzār and ‘ʿAbd al-Ḥaqq al-Ishbīlī said that it has no basis. Ibn Ḥajar, Ibn al-Jawzī, al-Mundhirī, al-Haythamī, and others all declared it as weak [ḍa’īf].
They said: Another excuse given by Imāms and mosque administrators is that children distract them from focusing during their prayer.