and Allah said "And proclaim the pilgramage among men; they will come to thee on foot and on every kind of camel. Lean on account of Journeys through deep and distant mountain highways" Surah 22 ~ Al Hajj Part 27
"The Jew could not help shouting at the top of his voice: 'O you Arabs! Here is your great man whom you have been waiting for!' So all the Muslims rushed to their arms and received Allah's Messenger on the summit of Harra. Singing "Thala al badru alaina...." (To this day this song evokes many emotions). The Prophet turned with them to the right and alighted at the quarters of Bani Amr Ibn Auf, and this was on Monday in the month of Rabi ul Awal. Abu Bakr stood up, receiving the people, while Allah's Messenger sat down and kept silent. Some of the Ansar who came and had not seen Allah's Messenger before began greeting Abu Bakr, but when the sunshine fell on Allah's Messenger and Abu Bakr came forward and shaded him with his sheet, only then the people came to know Allah's Messenger. Allah's Messenger stayed with Bani Amr Ibn Auf for ten nights and established the mosque (Mosque of Quba) which was founded on piety.
Masjid Al Quba today
Allah's Messenger prayed in it and then mounted his she-camel and proceeded on, accompanied by the people till his she-camel knelt down at the place of the Mosque of Allah's Messenger at Medina. Some Muslims used to pray there in those days, and that place was a yard for drying dates belonging to Suhail and Sahl, the orphan boys who were under the guardianship of Asad In Zurara. When his she-camel knelt down, Allah's Messenger said: 'This place, Allah willing, will be our abiding place.' Allah's Messenger then called the two boys and told them to suggest a price for that yard so that he might take it as a mosque. The two boys said: 'No, but we will give it as a gift, O Allah's Messenger!' Allah's Messenger then built a mosque there. The Prophet himself started carrying unburned bricks for its building and while doing so, he was saying: 'This load is better than the load of Khaibar, for it is more pious in the Sight of Allah and purer and better reward able.' He was also saying: 'O Allah! The actual reward is the reward in the Hereafter, so bestow Your Mercy on the Ansar and the Emigrants.' Thus the Prophet recited (by way of proverb) the poem of some Muslim poet whose name is unknown to me." (Ibn Shibab said, 'In the hadiths, it does not occur that Allah's Messenger recited a complete poetic verse other than this one.') (Sahih Al-Bukhari)
Masjid Al Nabi today
Thus was accomplished the hijrah, (or the flight of Muhammad (pbuh)) from which the Islamic calendar dates.
When the Prophet Muhammad and his companions settled at Yathrib, this city changed its name, and hence forth was called, Al-Medina Munawara, the Illuminated City , or more shortly, Medina , the City. It is situated about eleven-day's journey to the north of Mecca . At that time it was ruled by two Kahtanite tribes, Aws and Khazraj. These two tribes, however, were constantly quarreling among themselves. It was only about that time when the Prophet announced his mission at Mecca (Makkah) that these tribes, after long years of continuous warfare, entered on a period of comparative peace. When the Prophet settled at Medina , the tribes of Aws and Khazraj forgot entirely their old feuds and were united together in the bond of Islam. Their old divisions were soon effaced and the Ansar", the Helpers of the Prophet, became the common designation of all Medinites who had helped the Prophet in his cause. Those who emigrated with him from Mecca (Makkah) received the title of "Muhajereen" or the Emigrants. The Prophet, in order to unite both classes in closer bonds, established between them a brotherhood, which linked them together as children of the same parents, with the Prophet as their guardian.
The first step the Prophet took, after his settlement at Medina , was to built a mosque for the worship of Allah according to principles of Islam. Also, houses for the accommodation of the emigrants were soon erected.
Medina and its suburb were at this time inhabited by three distinct parties, the Emigrants, the Helpers, and the Jews. In order to weld them together into an orderly federation, the Prophet granted a charter to the people, clearly defining their rights and obligations. This charter represented the framework of the first commonwealth organized by the Prophet. It started thus:
'In the name of he Most Merciful and Compassionate Lord, this charter is given by Muhammad, the Messenger of Allah to all believers, whether of Quraish or Medina, and all individuals of whatever origin who have made common cause with them, who shall all constitute as one nation."