The warm welcoming by the “Ansaar”
After an eight-day journey, the Prophet arrived at Quba' on Rabia al-Awwal 8, the 14th year of Prophethood (corresponding to September 23, 622 CE) at noon. Quba' lies at a distance of a few miles from Al-Madeenah and was generally taken as the locality of Al-Madeenah. It was largely inhabited by Banu Amr bin Auf (an Arabic tribe) who had already been enlightened by Islam. A few days before the departure of the Prophet from Makkah, the news of his anticipated arrival in Al-Madeenah was in the air. The “Ansar” (Supporters of the Prophet) of Al-Madeenah would come out of their dwellings early in the morning and kept waiting till noon everyday. Thus, when the Prophet arrived at Quba' at noon, they had already gone back after waiting for some time.
A certain Jew who was watching the crowds of Muslims coming out of their settlement as if they were waiting for someone knew that Muhammad was approaching from Mecca. This Jew was then, by chance, upstairs when he witnessed the small caravan moving into Quba'; guessing it to be the caravan of the Prophet he cried at the top of his voice: "O people of Arabia, O those taking rest at noon, there has come your object of love." Having heard this call, the people rushed out of their dwellings and waves of joy gripped the whole atmosphere of Quba'. He was emerging from an orchard of dates. Bearing in mind that the people might fall into confusion regarding the identification of the Prophet Abu Bakr, may Allah be pleased with him, drew himself back and shaded the Prophet with his mantle, thus making a clear distinction between the Prophet and the companion.
The Prophet was now entering Quba' and the young girls of the “Ansar” were reciting in great fervor and boundless joy:
"On the hillside whence caravans are given a send-off,
The full moon comes up in the day.
All the while Allah is praised.
We had better return our thanks
The noble one, O you sent to us,
You have brought binding commands."
Building the Quba’ Mosque
The Prophet entered Quba' on Monday and stayed there until Friday. He stayed in the house of Khulthum bin Hadm while Abu Bakr, may Allah be pleased with him, stayed with Habeeb bin Asaf. He would hold his assemblies in the house of Sa'd bin Khaithamah, may Allah be pleased with him, and the people visited him at the same place. During this short stay in Quba', he laid the foundation of a mosque, which is the first mosque ever built after the advent of Islam. On Friday, the 12th of Rabi al-Awwal, he left Quba' and made his entry to Al-Madeenah. He was still in Quba' when Ali bin Abu Talib, may Allah be pleased with him, came and joined him. Ali, may Allah be pleased with him, had made this long and arduous journey on foot. While the Prophet was staying in Quba', Ali, may Allah be pleased with him, who had been busy returning the deposits of the people to their rightful owners (in Mecca) was blessed with the honor of joining the Prophet . He had left Makkah at about the time the Prophet was leaving the cave of Thaur. But since he was traveling by himself, Ali, may Allah be pleased with him, made his movements during the night and kept himself hidden in the day. The Prophet “” avoided busy roads and reached Quba' in eight days, while Ali undertook the journey by the well-known routes, but was late by three or four days because of being on foot.
Entry into Al-Madeenah
Taking the leave of the people of Quba' and Banu Amr bin Auf (Banu means tribe) on Friday, the Prophet moved forward to make his stay in Al-Madeenah. Every household of each locality expressed its strong desire that the Prophet should stay with them. He was in the locality of Banu Saalim bin Auf when the time for Friday (jumu'ah) prayer drew near. The Prophet “” led the prayer in the locality of Banu Saalim bin Auf in a field with about a hundred men behind him. This was the first Friday prayer of the Prophet “” in Al-Madeenah and the first time the Friday sermon (Khutbah) was ever delivered. Later on, a mosque was built at that place.
After offering the Friday prayer, the Prophet “” mounted his she-camel. Banu Saalim bin Auf approached him and took hold of his she-camel's rein requesting that he stay with them. People of other tribes and localities also came in groups and made the same request. This led to a clash of words, which ended when the Prophet “” said to one and all: "Let her go her way. She is guided by Allah. I shall stop where the animal sits down." The “Ansar” and “Muhajireen” (emigrants) followed the she-camel on all sides. He set the reins loose and the she-camel moved ahead slowly. All eyes were focused on the animal, and they were eagerly waiting for it to kneel down.
When the she-camel entered the locality of Banu Biyadah, Ziyad bin Labid and Urwah bin Amr, may Allah be pleased with them, the chieftains of the tribes wanted to take hold of the reins but the Prophet “” forbade them saying: "Leave her for she has already been commanded." Then, the she-camel stepped into the locality of Banu Sa'idah and Sa'd bin Ubadah and Mundhir bin Amr, may Allah be pleased with them, the chieftains of Banu Sa'idah made the same attempt but received the same words from the Prophet . After this, she reached the locality of Banu Al-Harith bin Al-Khazraj, and Sa'd bin Ar-Rabi', Kharijah bin Zaid and Abdullah bin Rawahah, may Allah be pleased with them, stepped forward to stop her but received the same reply. From there the she-camel made an entry into the locality of Banu Adi bin An-Najjar. Since Abdul Muttalib's mother, Salma bint Amr, belonged to this clan, they made their claim for the Prophet to stop there. Thus Salit bin Qais and Asirah bin Abu Kharija, the chieftains of Banu Adi, took hold of the reins but he asked them to leave it for the animal had prior instructions for herself. At last the she-camel arrived at the locality of Banu Malik bin An-Najjar and knelt down in a deserted and bare land for a while and then got up and advanced a little, only to turn back and be seated on the same spot again. This time she shook herself and then laid down on her neck wagging her tail.
Close to this unpopulated land was the house of Abu Ayub Khalid bin Zaid Ansari, may Allah be pleased with him. He rushed to the spot with his face beaming with joy and took the belongings of the Prophet to his house. Thus he stayed with him in his house. The deserted land was the property of two orphan boys Sahl and Suhail. It had a few date trees, some graves of polytheists and a resting spot for herds of cattle. "Who is the owner of this land?" The Prophet enquired. Mu'adh bin Afra responded, "This piece of land belongs to two orphan boys related to me, and I take care of them; I shall make them agree, you may take it for building a mosque." But the Prophet asserted, "I want to buy it, and will not take it without paying its price." Abu Bakr made the payment at once. With the order of the Prophet the date trees were cut, the graves leveled, and the construction work of the mosque was started then and there. The Prophet joined the builders. The walls of the mosque were constructed with stone and clay, the roof with wood and leaves of the date palm. Until his house was built, the Prophet continued to live with Abu Ayub Ansari, may Allah be pleased with him, for six months and a few days.
The mosque built during the time of the Prophet saw no change before the caliphate of Umar, may Allah be pleased with him. During his caliphate, it underwent an expansion for the first time. Uthman bin Affan, may Allah be pleased with him, strengthened it. During the time of Walid bin Abdul-Malik it saw more expansion with the inclusion of the dwellings of the noble wives of the Prophet .
The Prophet was in the house of Abu Ayub Ansari when he sent Zaid bin Harithath and Abu Rafi to bring Fatimah, Umm Kulthum, Saudah bint Zam'ah, Usamah bin Zaid and his mother, as well as Umm Aiman, may Allah be pleased with them. Talha bin Ubaidullah, along with Abdullaah bin Abu Bakr, and his relatives, also accompanied them, may Allah be pleased with them. After the arrival of these people, the Prophet moved into his newly built home.