`Umar asked the Prophet (ﷺ) "I vowed in the Pre-Islamic period of ignorance to stay in I`tikaf for one night in Al-Masjid al-Haram." The Prophet (ﷺ) said to him, "Fulfill your vow."
Sahih al-Bukhari Book 33, Hadith 7