Hadithcore
Riyad as-Salihin, 1269

'Aishah (May Allah be pleased with her) reported:

The Prophet (ﷺ) used to engage himself in I'tikaf (seclusion for prayers) in the mosque during the last ten nights of Ramadan till he passed away; thereafter, his wives followed this practice after him. <b>[Al- Bukhari and Muslim]</b>.

وعن عائشة رضي الله عنها أن النبي صلى الله عليه وسلم كان يعتكف العشر الأواخر من رمضان، حتى توفاه الله، تعالى ثم اعتكف أزواجه من بعده‏.‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏

References1 variant
In-Book Reference
Book 9, Hadith 2
Sharh · explanationclick to expand
<b>Guidance from the Hadiths:</b><br> 1) It is Sunnah to observe I‘tikāf in Ramadan and be devoted to worship.<br> 2) We are encouraged to seek out the night of Qadr during the last ten nights, at the time of I‘tikāf, given the special merit it has. A fortunate believer would seize virtuous times for performing acts of worship.<br> 3) A main purpose behind I‘tikāf is to devote one’s heart and body for worship, away from worldly preoccupations that distract him from worshiping his Lord.<br> Note:<br> The phrases some people say and hang on walls in the mosque, such as “I intend to observe I‘tikāf in this mosque as long as I remain in it”, are not prescribed by the Shariah, neither by the Prophet’s actions nor his statements. He did not instruct us saying: When you enter a mosque, harbor the intention for I‘tikāf at any time. Rather, we may observe I‘tikāf for a day or a night, and more, and preferably along with fasting. This general intention, however, is not part of the prescribed guidance.
Related hadiths3
Compare isnād across 3 related chains →