قَالَ مَالِك : وَلَا يَبِيتُ الْمُعْتَكِفُ إِلَّا فِي الْمَسْجِدِ الَّذِي اعْتَكَفَ فِيهِ ، إِلَّا أَنْ يَكُونَ خِبَاؤُهُ فِي رَحَبَةٍ مِنْ رِحَابِ الْمَسْجِدِ
Malik, may Allah have mercy on him, said: The person observing i'tikaf should not stay at night except in the mosque where he is observing i'tikaf; however, if his tent is in the courtyard of the mosque, then staying there is permissible.