She said that the Prophet used to visit the sick while engaged in a period of private devotion in the mosque and he would pass on straight ahead without pausing and ask for him.
‘A'isha said that when God’s messenger intended to engage in private devotion in the mosque he prayed the dawn prayer and then entered his place of seclusion.
She said that the sunna for one who is observing a period of private devotion in a mosque is not to visit an invalid, or attend a funeral, or touch or embrace one’s wife, or go out for anything but necessary purposes. There is no period of private devotion in a mosque without fasting, and it must be carried out in a congregational mosque.
Anas said that the Prophet was accustomed to engage in private devotion in the mosque during the last ten nights of Ramadan; but one year he omitted it and he engaged in it during twenty nights the next year.
Tirmidhi transmitted it, and Abu Dawud and Ibn Majah transmitted it from Ubayy b. Ka'b.