Messenger of Allah ﷺ came over to Medina and encamped at the upper side of Medina among the tribe known as Banu 'Amr b. 'Awf. He stayed among them for fourteen days. He then sent someone to call Banu al-Najjar. They came to him hanging their swords from the necks. Anas then said: As if I am looking at the Messenger of Allah ﷺ sitting on his mount and Abu Bakr seated behind him, and Banu al-Najjar standing around him. He descended in the courtyard of Abu Ayyub. The Messenger of Allah ﷺ would say his prayer in the folds of the sheep and goats. He commanded us to build a mosque. He then sent for Banu al-Najjar and said to them: Banu al-Najjar, sell this land of yours to me for some price. They replied: By Allah, we do not want any price (from you) except from Allah. Anas said: I tell what this land contained. It contained the graves of the disbelievers, dung-hills, and some trees of date-palm. The Messenger of Allah ﷺ commanded and the graves of the disbelievers were dug open, and the trees of the date-palm were cut off. The wood of the date-palm were erected in front of the mosque ; the door-steps wre built of stone. They were reciting verses carrying the stones. The Prophet ﷺ also joined them (in reciting verses) saying: O Allah, there is no good except the good of the Hereafter. So grant you aid to the Ansar and the Muhajirah.
قَدِمَ رَسُولُ اللَّهِ ﷺ الْمَدِينَةَ فَنَزَلَ فِي عُلْوِ الْمَدِينَةِ فِي حَىٍّ يُقَالُ لَهُمْ بَنُو عَمْرِو بْنِ عَوْفٍ فَأَقَامَ فِيهِمْ أَرْبَعَ عَشَرَةَ لَيْلَةً ثُمَّ أَرْسَلَ إِلَى بَنِي النَّجَّارِ فَجَاءُوا مُتَقَلِّدِينَ سُيُوفَهُمْ فَقَالَ أَنَسٌ فَكَأَنِّي أَنْظُرُ إِلَى رَسُولِ اللَّهِ ﷺ عَلَى رَاحِلَتِهِ وَأَبُو بَكْرٍ رِدْفَهُ وَمَلأُ بَنِي النَّجَّارِ حَوْلَهُ حَتَّى أَلْقَى بِفِنَاءِ أَبِي أَيُّوبَ وَكَانَ رَسُولُ اللَّهِ ﷺ يُصَلِّي حَيْثُ أَدْرَكَتْهُ الصَّلاَةُ وَيُصَلِّي فِي مَرَابِضِ الْغَنَمِ وَإِنَّهُ أَمَرَ بِبِنَاءِ الْمَسْجِدِ فَأَرْسَلَ إِلَى بَنِي النَّجَّارِ فَقَالَ يَا بَنِي النَّجَّارِ ثَامِنُونِي بِحَائِطِكُمْ هَذَا فَقَالُوا وَاللَّهِ لاَ نَطْلُبُ ثَمَنَهُ إِلاَّ إِلَى اللَّهِ ﷻ قَالَ أَنَسٌ وَكَانَ فِيهِ مَا أَقُولُ لَكُمْ كَانَتْ فِيهِ قُبُورُ الْمُشْرِكِينَ وَكَانَتْ فِيهِ خِرَبٌ وَكَانَ فِيهِ نَخْلٌ فَأَمَرَ رَسُولُ اللَّهِ ﷺ بِقُبُورِ الْمُشْرِكِينَ فَنُبِشَتْ وَبِالْخِرَبِ فَسُوِّيَتْ وَبِالنَّخْلِ فَقُطِعَ فَصَفُّوا النَّخْلَ قِبْلَةَ الْمَسْجِدِ وَجَعَلُوا عِضَادَتَيْهِ حِجَارَةً وَجَعَلُوا يَنْقُلُونَ الصَّخْرَ وَهُمْ يَرْتَجِزُونَ وَالنَّبِيُّ ﷺ مَعَهُمْ وَهُوَ يَقُولُ اللَّهُمَّ لاَ خَيْرَ إِلاَّ خَيْرُ الآخِرَهْ فَانْصُرِ الأَنْصَارَ وَالْمُهَاجِرَهْ