حَدَّثَنَا مُسَدَّدٌ، حَدَّثَنَا عَبْدُ الْوَارِثِ، عَنْ أَبِي التَّيَّاحِ، عَنْ أَنَسِ بْنِ مَالِكٍ، قَالَ قَدِمَ رَسُولُ اللَّهِ صلى الله عليه وسلم الْمَدِينَةَ فَنَزَلَ فِي عُلْوِ الْمَدِينَةِ فِي حَىٍّ يُقَالُ لَهُمْ بَنُو عَمْرِو بْنِ عَوْفٍ فَأَقَامَ فِيهِمْ أَرْبَعَ عَشَرَةَ لَيْلَةً ثُمَّ أَرْسَلَ إِلَى بَنِي النَّجَّارِ فَجَاءُوا مُتَقَلِّدِينَ سُيُوفَهُمْ - فَقَالَ أَنَسٌ - فَكَأَنِّي أَنْظُرُ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم عَلَى رَاحِلَتِهِ وَأَبُو بَكْرٍ رِدْفَهُ وَمَلأُ بَنِي النَّجَّارِ حَوْلَهُ حَتَّى أَلْقَى بِفِنَاءِ أَبِي أَيُّوبَ وَكَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يُصَلِّي حَيْثُ أَدْرَكَتْهُ الصَّلاَةُ وَيُصَلِّي فِي مَرَابِضِ الْغَنَمِ وَإِنَّهُ أَمَرَ بِبِنَاءِ الْمَسْجِدِ فَأَرْسَلَ إِلَى بَنِي النَّجَّارِ فَقَالَ ‏"‏ يَا بَنِي النَّجَّارِ ثَامِنُونِي بِحَائِطِكُمْ هَذَا ‏"‏ ‏.‏ فَقَالُوا وَاللَّهِ لاَ نَطْلُبُ ثَمَنَهُ إِلاَّ إِلَى اللَّهِ عَزَّ وَجَلَّ ‏.‏ قَالَ أَنَسٌ وَكَانَ فِيهِ مَا أَقُولُ لَكُمْ كَانَتْ فِيهِ قُبُورُ الْمُشْرِكِينَ وَكَانَتْ فِيهِ خِرَبٌ وَكَانَ فِيهِ نَخْلٌ فَأَمَرَ رَسُولُ اللَّهِ صلى الله عليه وسلم بِقُبُورِ الْمُشْرِكِينَ فَنُبِشَتْ وَبِالْخِرَبِ فَسُوِّيَتْ وَبِالنَّخْلِ فَقُطِعَ فَصَفُّوا النَّخْلَ قِبْلَةَ الْمَسْجِدِ وَجَعَلُوا عِضَادَتَيْهِ حِجَارَةً وَجَعَلُوا يَنْقُلُونَ الصَّخْرَ وَهُمْ يَرْتَجِزُونَ وَالنَّبِيُّ صلى الله عليه وسلم مَعَهُمْ وَهُوَ يَقُولُاللَّهُمَّ لاَ خَيْرَ إِلاَّ خَيْرُ الآخِرَهْ فَانْصُرِ الأَنْصَارَ وَالْمُهَاجِرَهْ
Translation
Anas b. Malik reported

Messenger of Allah (ﷺ) came to Medina and encamped at the upper part of Medina in a quarter called Banu 'Amr bin 'Awf. He stayed among them for fourteen nights, and then sent for Banu an-Najjar. They came wearing their swords. Anas said: It is as if I am looking at the Messenger of Allah (ﷺ) upon his mount, with Abu Bakr riding behind him, and the men of Banu an-Najjar surrounding him, until he dismounted in the courtyard of Abu Ayyub. The Messenger of Allah (ﷺ) used to pray wherever the prayer overtook him, and he would pray in the sheepfolds. Then he commanded that the mosque be built, and he sent for Banu an-Najjar and said: O Banu an-Najjar, name a price for me for this garden of yours. They said: By Allah, we do not seek its price except from Allah, the Mighty and Sublime. Anas said: There were things in it which I tell you about: there were graves of the polycognoscenti (pagans), ruins, and palm trees. The Messenger of Allah (ﷺ) commanded concerning the graves of the polytheists, and they were dug up; concerning the ruins, and they were leveled; and concerning the palm trees, and they were cut down. They arranged the palm trunks towards the Qiblah of the mosque and placed stones at its doorposts. They carried the rocks while chanting rajaz poetry, and the Prophet (ﷺ) was with them, saying: O Allah, there is no good except the good of the Hereafter, so help the Ansar and the Muhajirun.