when persecution of the prophet's peace be upon him companions increased severely, he peace be upon him gave them permission to emigrate from makkah to madinah. he peace be upon him was now assured that his da`wah had spread there and that it had become a suitable place to receive the emigrants. the believers began to emigrate in groups, one after another.
the prophet peace be upon him remained behind, and abu bakr –may allah be pleased with him- and `ali –may allah be pleased with him- remained with him. some others who had been forcibly detained by the quraysh remained as well. the quraysh knew that the muslims had gone to a safe place and feared the spread of the religion, so they met and agreed upon the assassination of allah's messenger peace be upon him.
on the night in which they planned to kill him almighty allah let his prophet peace be upon him know of what they were plotting. he ordered him to emigrate and join the believers and not to sleep in his bed that night. so the prophet peace be upon him told `ali –may allah be pleased with him- to sleep in his bed and cover himself with his garment, and then [the next day] to return to the people whatever they had kept with him in trust. `ali –may allah be pleased with him- did as he was told and slept in the prophet's peace be upon him bed while the swords were drawn outside the door.
the messenger of allah peace be upon him then went out, walking past those who were waiting to kill him. he threw dust on their heads and almighty allah blinded their vision. then he peace be upon him went on to the house of his friend, abu bakr –may allah be pleased with him- and they hurriedly left together during the same night. the prophet peace be upon him and abu bakr –may allah be pleased with him- walked until they reached the caveof thawrand remained inside the cave until the search for them had lessened.
the quraysh were enraged upon learning that their plot had failed. they sent out men to search for the prophet peace be upon him in every direction, promising anyone who brought him back or brought information about him one hundred she-camels. the search led some of them to the mouth of the cave. they stood outside it, but almighty allah turned them away and protected his prophet peace be upon him from their conspiracy. abu bakr –may allah be pleased with him- had said to him, "o messenger of allah, if one of them should look down toward his feet he would see us." but he peace be upon him replied,
" oabu bakr, what do you think about two of whom allah is the third?" (al-bukhari)
after three nights, the guide they had hired arrived with two camels as previously planned. they then headed toward madinah.
on the way they stopped at the tent of umm ma`bad al-khuza`iyyah. she had a dehydrated goat that could give no milk. the prophet peace be upon him took her permission to milk it and due to his blessing its udder filled with milk. he peace be upon him gave drink to her and to those with him and drank himself. then he peace be upon him milked it again, filled her container and left.
suraqah ibn malik heard that the prophet peace be upon him had taken the coastal route. he aspired to earn the reward offered by the quraysh so he took his bow, mounted his horse and set out in pursuit. as he approached, the prophet peace be upon him supplicated and his horse stumbled and fell. he realized that it was due to the prophet's peace be upon him supplication and that he was protected. he requested security and promised to mislead his pursuers. so the messenger of allah peace be upon him supplicated for him and his horse regained its strength. he returned to makkah and began deceiving people regarding the direction the prophet peace be upon him had taken.
the ansar would come out to the entrances of their city awaiting the arrival of the prophet peace be upon him and then return to their homes when the heat increased. on monday, the 12th of rabi` al-awwal in the thirteenth year of prophethood, someone shouted that the prophet peace be upon him had been seen approaching. cries of "allahu akbar" could be heard everywhere, and the people ran out to receive the messenger of allah peace be upon him.
he peace be upon him first stayed at quba' and established a masjid there, the first masjid built in islam. after a few days in quba' the prophet peace be upon him went on to madinah. while on his way the time came for the jumu`ah (friday) prayer, so he peace be upon him led those muslims who accompanied him in the prayer. it was their first jumu`ah prayer.
after the prayer the prophet peace be upon him entered madinah from the south. from that day it was called "madinat ar-rasul" (city of the messenger peace be upon him). there was joy and elation throughout the city at the arrival of the prophet peace be upon him. it had become a secure home from which muslims could convey the message of almighty allah to the world, east and west.