
The history of Masjid Quba (Quba Mosque) in Madinah, the first mosque in Islam, founded by the Prophet ﷺ on taqwa, and the reward of praying there.
Masjid Quba is the first mosque built in Islam. The Prophet ﷺ founded it in 622 CE, the first year of the Hijrah, during the days he spent at Quba on the edge of Yathrib before entering the city that became Madinah.1
The building has been renewed many times since, but its standing has never changed. Many commentators identify it with the mosque the Qur'an praises as founded on righteousness from the first day, the Prophet ﷺ visited it every Saturday, and a prayer offered in it carries the reward of an Umrah. Today it stands just under two miles (about 3 km) south of Masjid al-Nabawi, and in 2025 it welcomed more than 26 million visitors.2

Quba was the first village a traveller reached on the road from Makkah. Set among palm groves and wells, it was home to the clan of Banu Amr ibn Awf, many of whom had already embraced Islam.3
When the believers of Yathrib heard that the Prophet ﷺ had left Makkah, they went out every morning to the edge of the volcanic plain to wait for him, and went home only when the midday heat became too strong. One day in Rabi al-Awwal, just after they had returned, a man watching from the top of a fort saw the travellers approaching in white garments and called out that the one they were waiting for had come. The Muslims hurried out to meet him, and on a Monday the Prophet ﷺ turned towards Quba and stopped among Banu Amr ibn Awf.1
Many of the Ansar had never seen him, and some began greeting Sayyiduna Abu Bakr al-Siddiq. When the sun fell on the Prophet ﷺ, Abu Bakr stepped forward and shaded him with his cloak, and the people then knew which of the two was the Messenger of Allah ﷺ.1
The Prophet ﷺ stayed in the house of Kulthum ibn al-Hidm3 and remained among Banu Amr ibn Awf for a little over ten nights.1 During that time Sayyiduna Ali arrived from Makkah. He had stayed behind to return the deposits that people had left with the Prophet ﷺ, and then made the long journey on foot to join him.3
Prayer had already begun at Quba before the Prophet ﷺ arrived. The first emigrants from Makkah gathered at a place there called al-Usbah, and Salim, the freed slave of Abu Hudhayfah, led them in prayer because he knew more of the Qur'an than any of them.4 The ground they prayed on had been used by the clan to dry its dates.5
On that ground the Prophet ﷺ founded the mosque. He asked the people of Quba to bring stones, laid the first one in the direction of the qiblah with his own hands, and had Sayyiduna Abu Bakr and Sayyiduna Umar lay the next.56 Ammar ibn Yasir worked harder than anyone on the building and became known as the first person in Islam to build a mosque.5 Ibn Kathir mentions a report that Sayyiduna Jibril showed the Prophet ﷺ the direction of the qiblah when the mosque was founded, adding that Allah knows best.7
The first building was a simple walled enclosure open to the sky, with a shaded area along the qiblah side, which then faced Bayt al-Maqdis.6 When his stay came to an end, the Prophet ﷺ prayed in the mosque, mounted his she-camel and rode on into the city, where his camel knelt at the place that became Masjid al-Nabawi.1
The Qur'an speaks of a mosque founded on righteousness from the first day, in verses revealed about a rival building nearby. Ibn Kathir explains that a group of hypocrites built a mosque next to Masjid Quba in order to divide the believers, and asked the Prophet ﷺ to pray in it. On his way back from Tabuk, revelation came forbidding him to stand in it, and he sent Companions to pull it down.8
لَا تَقُمْ فِيهِ أَبَدًا ۚ لَّمَسْجِدٌ أُسِّسَ عَلَى ٱلتَّقْوَىٰ مِنْ أَوَّلِ يَوْمٍ أَحَقُّ أَن تَقُومَ فِيهِ ۚ فِيهِ رِجَالٌ يُحِبُّونَ أَن يَتَطَهَّرُوا۟ ۚ وَٱللَّهُ يُحِبُّ ٱلْمُطَّهِّرِينَ
“Do not stand [for prayer] within it - ever. A mosque founded on righteousness from the first day is more worthy for you to stand in. Within it are men who love to purify themselves; and Allāh loves those who purify themselves.”
Surah al-Tawbah 9:108
Ibn Kathir records that many of the early generations, among them Ibn Abbas, Urwah ibn al-Zubayr, al-Sha'bi and al-Hasan al-Basri, understood the mosque in this verse to be Masjid Quba. He also cites the hadith in which the Prophet ﷺ named his own mosque in Madinah as the mosque founded on taqwa,9 and he sees no contradiction between the two: if Quba was founded on taqwa from its first day, then Masjid al-Nabawi is even more deserving of the description.7
The verse also praises the people of Quba as men who love to purify themselves. Ibn Kathir brings several reports in which the Prophet ﷺ asked them about the purification for which Allah had praised them, and they told him that they washed with water after relieving themselves.7

For sixteen or seventeen months after the Hijrah the Prophet ﷺ prayed facing Bayt al-Maqdis, until Allah commanded him to face the Ka'bah in Makkah.10 The news reached Quba during the Fajr prayer. The worshippers were facing Bayt al-Maqdis when a man came and told them that Qur'an had been revealed to the Messenger of Allah ﷺ that night commanding him to face the Ka'bah, and they turned round towards the Ka'bah where they stood.11
They changed direction the moment the command reached them, without waiting to finish their prayer, and the scene has been remembered ever since as an example of how the Companions received revelation. Historians of the mosque hold that it was then rebuilt to face the new qiblah.6
Quba remained dear to the Prophet ﷺ for the rest of his life in Madinah, and he returned to it every week. Ibn Umar said:
كَانَ النَّبِيُّ صلى الله عليه وسلم يَأْتِي مَسْجِدَ قُبَاءٍ كُلَّ سَبْتٍ مَاشِيًا وَرَاكِبًا
“The Prophet (ﷺ) used to go to the Mosque of Quba every Saturday (sometimes) walking and (sometimes) riding.”
Sahih al-Bukhari 1193
Ibn Umar kept up the same practice himself, and another narration adds that the Prophet ﷺ would pray two rak'ahs there.12
The Prophet ﷺ attached a remarkable reward to praying in Masjid Quba. Sahl ibn Hunayf narrated:
مَنْ تَطَهَّرَ فِي بَيْتِهِ، ثُمَّ أَتَى مَسْجِدَ قُبَاءٍ، فَصَلَّى فِيهِ صَلاَةً، كَانَ لَهُ كَأَجْرِ عُمْرَةٍ
“The Messenger of Allah (ﷺ) said: ‘Whoever purifies himself in his house, then comes to the Quba’ Mosque and offers one prayer therein, will have a reward like that for ‘Umrah.”
Sunan Ibn Majah 1412
Usayd ibn Zuhayr al-Ansari narrated that the Prophet ﷺ said:
الصَّلاَةُ فِي مَسْجِدِ قُبَاءٍ كَعُمْرَةٍ
“The Salat in Masjid Quba is like Umrah.”
Jami' at-Tirmidhi 324
Each generation that cared for Madinah added to Quba. The caliph Uthman ibn Affan enlarged the mosque, and in the early eighth century Umar ibn Abd al-Aziz rebuilt it in cut stone, roofed it with fine timber, decorated it with mosaics and gave it its first minaret.6 Early historians of the city such as Ibn Shabbah describe a square building of about 32 metres a side around an open courtyard, with walls some 9 metres high and a minaret of around 24 metres.6
Later rulers kept up the work. A mihrab was added in 435 AH (1044 CE), and the Zengid vizier Jamal al-Din al-Isfahani renovated the mosque in 555 AH (1160 CE). The Mamluk sultans restored it in turn: al-Nasir Muhammad ibn Qalawun rebuilt it in 733 AH (1333 CE), al-Ashraf Barsbay renewed its ceiling in 840 AH (1436 CE), and Qaytbay restored it in 881 AH (1476 CE).6
Under the Ottomans, Sultan Suleiman rebuilt the minaret and ceiling in 950 AH (1543 CE). The largest Ottoman works began under Sultan Mahmud II in 1245 AH (1829 CE), when the flat roof was replaced with rows of shallow domes, and continued under Sultan Abdulmecid.6

In 1968, under King Faisal, the outer walls were renewed, the northern portico was extended with an entrance for women, and the minaret, which had stood on its own, was joined to the main building.6
The mosque that visitors see today was built under King Fahd, who laid its foundation stone on 3 November 1984. It was designed by the Egyptian architect Abdel-Wahed El-Wakil and opened on 2 November 1986. El-Wakil kept to the traditional architecture of Madinah, with white ribbed domes, basalt facing and a modest exterior. The building has four minarets, six large domes over the prayer hall and fifty-six smaller domes around its edge, and it was built for about 20,000 worshippers, with a two-storey women's area on the northern side for around 7,000.6
A new chapter began in April 2022 with the launch of the King Salman Project, the largest expansion in the mosque's history. It will increase the mosque's area from 5,035 to 50,000 square metres and its capacity to around 66,000 worshippers, surrounding the existing building with shaded courtyards linked to separate prayer halls, and it will also revive historic sites around the mosque.6 Work has continued through 2025 and 2026, adding 2,500 square metres of new prayer space, more than 150 external canopies and misting fans across the courtyards.213
Masjid Quba lies just under two miles (about 3 km) south of Masjid al-Nabawi. It is connected to Masjid al-Nabawi by the Quba Walking Trail, a wide landscaped pedestrian avenue that follows the route the Prophet ﷺ took on his visits to Quba.14 The walk takes around forty minutes, and taxis and ride-hailing apps make it a short drive.
The women's prayer area is in the northern part of the mosque.6
Just to the north is Masjid al-Jumu'ah, built where the Prophet ﷺ led the first Friday prayer as he travelled from Quba into the city.3
