Shamakhi Juma Mosque, one of the oldest Muslim temples in Azerbaijan, as well as in the South Caucasus and the Middle East, was built in 743 in honor of the arrival of khalifa Khalid ibn Waliyah’s brother Muslim ibn Waliyah to Azerbaijan. According to some sources, the Khazar kagan, defeated by the Caliphate armies, embraced Islam in this mosque.
In 1859, the devastating earthquake in Shamakhi, one of the largest provinces of the Caucasus, destroyed the city and moved to the center of Baku city. After the earthquake, the restoration of the mosque was entrusted to Gasim bey Hajibababayov, a Shamakhi native. The mosque was not destroyed during the next 1902 earthquake. After that, it was decided to rebuild the mosque on the previous one. The architect Zivarbey Ahmedbeyov, and then the Polish architect Joseph Ploshko carried out the restoration. The restoration work under Plosko's somewhat original and original design was not completed.
The Armenian genocide was carried out in Shamakhi during March 1818 massacre by Armenian Dashnak groups. The biggest massacre took place at the Friday mosque. Seeing Shamakhi refugees in the mosque as the house of God, Armenians set fire to the area and killed about 1,700 innocent people. In Soviet times, the mosque, which was not used for designated reasons, was facing the threat of destruction. This historic monument was renovated in the 1980s on the initiative of great leader Heydar Aliyev, who attaches great importance to the development of Azerbaijan in all areas, including the protection of our national spiritual values. Shamakhi Friday Mosque has been renovated within the framework of the Heydar Aliyev Foundation's project "Address to Tolerance - Azerbaijan". The restoration and reconstruction works started in March 2010. President of the Republic of Azerbaijan Ilham Aliyev attended the opening ceremony of the mosque on May 17, 2013.
During the restoration and reconstruction work, the traditions of the Shirvan Architectural School have been given maximum attention to the restoration of the mosque with a total area of about one hectare. The entrance to the mosque, with a height of 36.4 meters, has been refined in the middle, large and right and left domes. The middle salon has been redesigned in the style of national architecture. Up to 1,500 people can worship at the same time. The madrassahs, cells and graves discovered during the repair work in the 70-80s of last century were preserved. Located in Shamakhi Seismic Zone, the foundation of the mosque is strengthened with reinforced concrete structures.
The courtyard of the mosque has been renovated, two pools have been built, and six galleries have been created. The two-storey administrative building area is 804 square meters. There is a conference room and a rich library in the mosque. The 520-square-foot apartment houses a 250-seat ceremony and a modern kitchen. Major renovations have also been done around the Shamakhi Juma Mosque's State Historical and Architectural Monument.