Laylat al-Mabit (Arabic: لَـیْـلَـة ٱلْـمَـبِـیْـت, lit. 'the overnight stay') refers to the night in 622 CE in which the Islamic prophet Muhammad left Mecca for Yathrib, a city that was later renamed Medina in his honor. Laylat al-Mabit is often associated in Islamic literature with the reports that Muhammad's cousin Ali risked his life for Muhammad's safe escape from Mecca. Ali (r. 656–661) later became the fourth caliph after Muhammad and is regarded as the first Shia Imam.
As the persecution of early Muslims in Mecca continued, or perhaps with the hope of better prospects, Muhammad asked his followers to emigrate to Yathrib, whose residents had pledged to protect Muhammad there. To attract less attention, Muslims left Mecca in small groups, throughout the summer of 622, while Muhammad remained behind in Mecca to organize and encourage the emigration efforts, or perhaps to ensure an independent position in Yathrib upon his arrival. Alarmed by the new developments, the Meccan clan leaders decided to murder Muhammad. The plan was for a group of warriors, one from each Meccan clan, to kill Muhammad together in his sleep to avoid any potential retribution from Muhammad's clan, the Banu Hashim.
An informant or elsewhere the angel Gabriel disclosed the assassination plot to Muhammad. To foil their plans, his young cousin Ali ibn Abi Talib risked his life and slept in Muhammad's bed that night instead of him. Alternatively, Ibn Ishaq (d. 767) writes that Muhammad reassured Ali of his safety in advance. In the meantime, Muhammad left Mecca under cover of darkness, joined later by another companion named Abu Bakr. In a last-minute change of plans, however, the assassins waited until the next morning to attack. At dawn, they broke into the house and found Ali, whose life they spared.
After Muhammad's departure, Ali stayed behind for a few days to return the goods entrusted to Muhammad, who was respected in Mecca as the al-Amin (lit. 'the trustworthy'). Then Ali too escaped Mecca together with a few Muslim women, including his mother Fatima bint Asad and Muhammad's daughter Fatima. Muhammad is said to have waited outside of Yathrib in Quba for Ali to join him before entering the city on 27 September 622. Yathrib was later renamed Medinat al-Nabi (lit. 'city of the prophet') or simply Medina in his honor.
Some authors give this incident as the reason for the revelation of verse 2:207 of the Quran, "But there is also a kind of man who gives his life away to please God, and God is most compassionate to his servants." These include Muhammad's cousin and early exegete Ibn Abbas (d. 687), the Sunni al-Tha'labi (d. 1035-6), al-Razi (d. 1209), and al-Haskani, the Shia al-Tabarsi (d. 1153), al-Hilli (d. 1325), al-Balaghi (d. 1933), and the Mu'tazilite Ibn Abi'l-Hadid (d. 1258).