It was the 13th year of Muhammad's mission when the clouds had gathered fast. The Meccan chiefs centred in their Council Hall (darun-nadwa), a chamber inside Kaba, to deliberate over what might be done with Muhammad. Stormy was the meeting, for fear had entered their hearts. Imprisonment for life, expulsion from the city, each was debated in turn for Muhammad. They decided then on a final and desperate remedy, namely to murder Muhammad. Murder by one man would have exposed him and his family to the vengeance of blood. The difficulty was at last solved by Abu Jahl, who suggested that a number of courageous men, chosen from different families, should sheathe their swords simultaneously in Muhammad's bosom, in order that the responsibility of the deed might rest upon all, and the relations of Muhammad might consequently be unable to avenge it. The proposal was accepted, and forty youths were selected for the sanguinary deed. As the night advanced, and it was against the Arab sense of chivalry to kill any one within the four walls of his house at night hour. Hence, the assassins posted themselves round the Muhammad's dwelling, and watched all night long, peeping now and then through a hole in the door to make sure that Muhammad still lay on his bed. In order to keep the attention of the assassins fixed upon the bed, Muhammad put his own green coverlet upon Ali, and bade him to lie on his bed; so as to fail the scheme of his enemies, and himself escaped.
Muhammad had guessed exactly what would be the reactions of the Meccans when they found he had gone. He had, therefore, not started for Yathirab with camel. He had gone on foot with Abu Bakr to Mount Thaur, about one hour's walk from Mecca. They reached Mount Thaur while it was still dark and concealed themselves in the innermost recess of a cave in the rocky hillside. A tracking party, following the footprints of the fugitives, reached the mouth of the cave. Abu Bakr, hearing the sound of their footsteps, grieved within himself. It was a critical moment when the sword of the blood-thirsty enemy was hanging on their heads. Muhammad quieted the fears of Abu Bakr with the words: "Do no be grieved, for surely God is with us." For full three days, Muhammad remained in the cave.
On the third night, they came out with two camels. Quickly Muhammad mounted and followed by Abu Bakr, rode into the desert night. They took a certain Abdullah bin Uraiqi, a non-Muslim as their guide. In order to avoid the main caravan tracks, they struck a diagonal course northwest toward the Red Sea. For nearly a week the journey continued over the parched, barren, mournful wasteland. No living creatures, not even vultures or snakes, inhabited this wilderness. They first had proceeded parallel to the Red Sea until they reached a place called Usfan. From here they turned a little inland and travelled for some distance along the foot of Mount Amaj. Then they followed a route parallel to the usual route. They went past Qudayda, al-Kharrar, Thanniyya al-Marrah and Liqfa, and crossed the territories of Banu Madlijah and Banu Aslam, where they alighted for a while. Here Muhammad hired a camel to relieve his own which was exhausted by the long non-stop journey. Before they entered Kuba, they passed through such places as al-Araj, Thanniya al-Ghair and the valley of Ri'm. On the seventh morning after the start of the flight, the oasis of Kuba, a few miles from Yathirab, was sighted. This flight of Muhammad from Mecca to Yathirab (Medina) is called the Hijrah and when Muhammad entered Kuba, with it commenced the Islamic era on 1st Muharram (lunar month) of the Hijrah, or on the date corresponding to July 16, 622 C.E. in the Julian calendar. In English this is usually abbreviated in the Latin form AH (Anno Hegirae i.e., "in the year of the Hijrah"). This Islamic calendar was introduced after 17 years during the caliphate of Umar.
On the other side in Mecca, Ali slept fearlessly whole night on Muhammad's bed. R.V.C. Bodely writes in "The Messenger" (London, 1946, p. 113) that, "The morning breeze whispered over the desert. The dawn came mauvely from the east and showed the assassins braced to strike. As the first white rays of the rising sun hit the flat roofs of Mecca, the door of Muhammad's house opened. The men stood ready to spring. They then held back as their astonished eyes rested on the burly figure of Ali standing on the threshold carrying Muhammad's cloak over his arms." The assassins at first thought of killing him, but when they found him ready to defend himself, they gave up the idea and dispersed in search of Muhammad. Discomfited and unhappy, they immediately dispatched their best riders in pursuit of the fugitive. Up and down they hunted over all the tracks and passes leading out of Mecca, but found no trace of Muhammad.
Ali stayed three days at Mecca and handed back all the articles which were entrusted to Muhammad for safe custody, mostly by his enemies, secured their receipts and quitted the city in broad daylight. Ali was also assigned for safe transport of Muhammad's daughter Fatima, the daughter of Hamza, another Fatima, his own mother, Fatima bint Asad, and his aunt, that was the daughter of Abdul Mutalib, a fourth Fatima. On account of scarcity of mounts, Ali had to travel on foot, and reached Kuba with bleeding feet. Muhammad embraced him, and dressed his feet. Muhammad stayed with the clan of Umar bin Auf at Kuba for 14 days, and during which time he laid foundation of the first mosque (Arabic masjid, the English mosque through the Italian moschea) of Islam. It is of this mosque that Koran (9:109) speaks as "the mosque founded on piety."
The news of Muhammad's arrival at Kuba soon reached Yathirab and the city had been in eager expectation of his arrival. Each morning some people would go out on the outskirts to watch the appearance of their revered master. The tedious hours of impatient expectancy were at last over, and the illustrious visitor appeared on the horizon of Yathirab. At last the great day arrived. News was brought to Yathirab that Muhammad was on his way. He entered the city on September 22, 622. Yathirab was wearing to look of jubilation all round. People came out to greet Muhammad, clad in their gayest attire. Women climbed to the tops of their houses and sang in chorus to welcome their noble guest. Syed Waheeduddin writes in "The Benefactor" (Lahore, 1964, p. 33) that, "The Banu Najjar led the welcoming crowds in full armour, their weapons glistening in the sun. The whole of Yathirab lined the road in orderly rows. Young girls played on their tambourines and sang songs of welcome." There was an unprecedented merry-making, and when Muhammad came to the group of Umar bin Awf Najjari, the well-dressed girls came out of seclusion, danced and sang to the tune of music the following ballad:
"We belong to the clan of Najjar, (we are) Muhammad's soldiers from the Jari."
Each tribe, which Muhammad passed through in the city, very eagerly desired the honour of his presence and requested him to take up his abode with them. He, refusing all these offers, said that the camel, which he rode on, was inspired and would take him to the proper quarter. The camel proceeded on to the eastern quarter, and knelt down in the open courtyard of the Banu Najjar, near the house of Abu Ayub Ansari. He took up his temporary residence in his house for about seven months, until a mosque with proper quarters for himself was built in Medina.