It was built by the Ghurids, under the rule of Sultan Ghiyath al-Din Muhammad Ghori, who laid its foundation in 1200 CE.
Later, it was extended several times as Herat changed rulers down the centuries from the Kartids, Timurids, Mughals and then the Uzbeks, all of whom supported the mosque.
The fundamental structure of the mosque from the Ghurid period has been preserved, but parts have been added and modified.
In the second half of the 11th century, a Herat mosque was founded under the rule of the Khwarazmian dynasty.
Herat is an important city because of its strategic position near the main commercial routes, connecting the Mediterranean to India or China, and the resulting prosperity.
[7] At the end of the 12th century, Sultan Ghiyath al-Din Muhammed ibn San initiated the rebuilding of the city's main mosque in Herat.
[4] The land was located in the north-eastern, mainly administrative quarter of Herat and not directly in the center.
Furthermore, it had a direct water supply from the main channel joy-i-enjil for the fountain of the mosque.
[2] By building the mosque on an already known site, the Ghurids could demonstrate their architectural patronage, as well as political power.
[7] Some sources also believe that the Sultan ordered the mosque to be built for Imam Fakhr-ul-Razi, a religious leader.
Stylistic analysis and historical inscriptions found during a renovation in 1964 prove that the building is attributed to the Ghurids.
The inner courtyard facades were decorated with mosaic of glazed tiles, including the name of Shah Rukh.
[2][4] Later, under the rule of Sultan Husayn Bayqara, his advisor Mir Ali-Shir Nava'i devoted himself to remodeling the mosque.
[2][4] He made structural changes to the propositions, such as lowering the Ghuridic archway at the southeast corner.
In addition, he ordered mosaic tiles with geometric patterns to be applied to further parts of the mosque.
During the 18th century, the frontal facade of the main iwan from the Timurid period collapsed and had to be rebuilt.
This was the case despite the abuse of the minarets by Soviet soldiers and huge tanks moving around the area.
[2][16] During the Taliban's rule in Herat between 1996 and 2001, the entry to the mosque was banned for all non-muslims, including UN staff.
[9] A significant part of the present mosque is covered with glazed tiles in bright colors according to Timurid tradition.
[2] In the southern and western iwan interior, decorative elements of the Ghurid period are uncovered.
[12] The vertically placed bands of inscriptions are made of terracotta and worked into the base's mortar like a mosaic.
On the front, they are glazed blue, contrasting with the light red brick tone of the background.
[2][12] The sidewalls of the portal are decorated with geometrical brick mosaic, interspersed with blue glazed tile plugs.