Only after several months did Allah grant the Prophet (peace and blessings be upon him) permission to leave Makkah. Shortly before his departure, Jibreel (Angel Gabriel) told Muhammad that the Quraysh had devised a plot to stab him while he was sleeping. On the night of the planned assassination, his cousin `Ali ibn Abi Talib slept in Muhammad’s bed while the latter escaped with his friend Abu Bakr As-Siddiq to a cave south of Makkah, opposite the direction to Madinah. Fortunately for `Ali, the assassins looked at his face before stabbing him and left him alone when they realized they had been outwitted.
Muhammad and Abu Bakr hid in the cave for three days while the Quraysh searched all around Makkah. At one point, their enemies were only a few feet away outside the cave, but Allah protected them by simple everyday “miracles.” A spider spun its web across the mouth of the cave, pigeons nested and laid eggs in front of it, and the branches of a small tree blocked it. Thus the pursuers assumed no one had entered the cave recently and did not search it.