The Quba Mosque (Arabic: مَسْجِد قُبَاء‎, romanized: Masjid Qubāʾ, Hejazi Arabic pronunciation: [mas.dʒɪd ɡʊ.ba]) is a mosque located in Medina, in the Hejazi region of Saudi Arabia, built in the lifetime of the Islamic prophet Muhammad in the 7th century C.E. It is thought to be the first mosque in the world, built on the first day of Muhammad's emigration to Medina. Its first stone is said to have been laid by the prophet, and the structure completed by his companions.
 As per historical Islamic texts, Muhammad spent 14 days in this mosque praying qaṣr (Arabic: قَصْر, a short prayer) while waiting for Ali to arrive in Medina, after he stayed behind in Mecca to safeguard Muhammad's life and escape, by sleeping in Muhammad's bed in his place. Performing Wuḍūʾ ('Ablution') in one's home, then offering two Rakaʿāt of Nafl (Optional) prayers in the Quba Mosque, is considered to be equal to performing one ʿUmrah. Muhammad used to go there, riding or on foot, every Saturday and offer a two rakaʿāt prayer. He advised others to do the same, saying, "Whoever makes ablutions at home and then goes and prays in the Mosque of Quba, he will have a reward like that of an 'Umrah." This ḥadīth was reported by Ahmad ibn Hanbal, Al-Nasa'i, Ibn Majah and Hakim al-Nishaburi.[citation needed] Initially, the mosque was built 6 kilometres (3.7 miles) off Medina in the village of Quba, before Medina expanded to include this village.
 When the Driehaus Prize winner and New Classical architect Abdel-Wahed El-Wakil was commissioned, in the 20th century[vague], to conceive a larger mosque, he intended to incorporate the old structure into his design. But the old mosque was torn down and replaced with a new one.
 The new mosque consists of a rectangular prayer hall raised on a second story platform. The prayer hall connects to a cluster containing residential areas, offices, ablution facilities, shops and a library.[citation needed]
 The recent new construction of the Quba Mosque that happened in 1984 include many new additions, such as 7 main entrances, 4 parallel minarets, and the 56 mini domes that surround the perimeter of the mosque from an overhead point of view. The courtyard of this mosque is composed of black, red, and white marble, and majority of the structure and interior structures such as the minbar and mihrab are all composed of white marble. Originally, there was one minaret, the new renovations included the addition of the other three minarets, they rest on square bases, have octagonal shafts which take on a circular shape as they reach the top.[citation needed]
 The prayer hall is arranged around a central courtyard, characterised by six large domes resting on clustered columns. A portico, which is two bays in depth, borders the courtyard on the east and west, while a one-bayed portico borders it on the north, and separates it from the women's prayer area.
 The women's prayer area, which is surrounded by a screen, is divided into two parts as a passageway connects the northern entrance with the courtyard.[citation needed] When Quba Mosque was rebuilt in 1986, the Medina architecture was retained – ribbed white domes, and basalt facing and modest exterior – qualities that recalls Madina's simplicity. The courtyard, is flagged with black, red and white marble. It is screened overhead by day from the scorching heat with shades. Arabesque latticework filters the light of the palm groves outside.  Elements of the new building include work by the Egyptian architect Abdel-Wahed El-Wakil, Pakistani architect Hassan Khan Sayyid and the Stuttgart tensile architect Mahmoud Bodo Rasch, a student of Frei Otto.
 Depending on whether the Mosque of the Companions in the Eritrean city of Massawa is older or not, it may be the first mosque in the world, but according to legend, the sanctuary of the Kaaba in Mecca dates to the time of Ibrahim (Abraham) and Ismaʿil (Ishmael).
 The merits of the mosque are mentioned in nineteen Sahih al-Bukhari hadiths; thirteen Sahih Muslim hadiths; two Sunan Abu Dawood hadiths; six Al-Muwatta hadiths.
 Muhammad frequented the mosque and prayed there. This is referred to in a number of hadith:
 Narrated 'Abdullah bin Dinar:
Ibn 'Umar said, "The Prophet used to go to the Mosque of Quba every Saturday (sometimes) walking and (sometimes) riding." 'Abdullah (Ibn 'Umar) used to do the same Narrated Ibn 'Umar:
The Prophet used to go to the Mosque of Quba (sometimes) walking and sometimes riding. Added Nafi Mawla Ibn Umar (in another narration), "He then would offer two Rakat (in the Mosque of Quba)." It is believed to be the mosque which the Quran mentions as being founded on piety and devoutness (Masjid al-Taqwa)
 There are also those ˹hypocrites˺ who set up a mosque ˹only˺ to cause harm, promote disbelief, divide the believers, and as a base for those who had previously fought against Allah and His Messenger. They will definitely swear, "We intended nothing but good," but Allah bears witness that they are surely liars. Do not ˹O Prophet˺ ever pray in it. Certainly, a mosque founded on righteousness from the first day is more worthy of your prayers. In it are men who love to be purified. And Allah loves those who purify themselves.