[Machine] The Messenger of Allah ﷺ observed i'tikaf during the middle ten days of Ramadan while seeking Laylat al-Qadr before it was made clear to him. When it had elapsed, he commanded that a shelter be constructed but it was torn down. Then, it was revealed that it was in the last ten days, so he ordered for it to be reconstructed and observed i'tikaf during the last ten days. He then came out to the people and said, "I was informed of the night of Laylat al-Qadr, so I came out to inform you of it, but two men along with Satan came to me and I forgot it. So, seek it in the ninth, seventh, and fifth nights."
اعْتَكَفَ رَسُولُ اللهِ ﷺ الْعَشْرَ الْأَوْسَطَ مِنْ رَمَضَانَ وَهُوَ يَلْتَمِسُ لَيْلَةَ الْقَدْرِ قَبْلَ أَنْ تُبَانَ لَهُ فَلَمَّا انْقَضَيْنَ أَمَرَ بِالْبِنَاءِ فَنُقِضَ ثُمَّ «أُبِينَتْ أَنَّهَا فِي الْعَشْرِ الْأَوَاخِرِ» فَأَمَرَ بِالْبِنَاءِ فَأُعِيدَ وَاعْتَكَفَ الْعَشْرَ الْأَوَاخِرَ فَخَرَجَ عَلَى النَّاسِ فَقَالَ «إِنِّي أُنْبِئْتُ لَيْلَةَ الْقَدْرِ فَخَرَجْتُ لِأُخْبِرَكُمْ بِهَا فَجَاءَ رَجُلَانِ مَعَهُمَا الشَّيْطَانُ فَنَسِيتُهَا فَالْتَمِسُوهَا فِي التَّاسِعَةِ وَفِي السَّابِعَةِ وَفِي الْخَامِسَةِ»