Shamakhi District () is one of the 66 districts of Azerbaijan. It is located in the east of the country and belongs to the Mountainous Shirvan Economic Region. The district borders the districts of Quba, Khizi, Gobustan, Hajigabul, Agsu, and Ismayilli. Its capital and largest city is Shamakhi. As of 2020, the district had a population of 106,400. In its history, eleven major earthquakes have rocked Shamakhi, but each time it was reconstructed by its inhabitants due to its role as the economic and administrative capital of Shirvan and one of the key towns on the way of the Silk Road. The only building to have survived eight of the eleven earthquakes is the landmark Juma Mosque (8th century CE). History Shamakhi was first mentioned as Kamachia by ancient Greco-Roman geographer Claudius Ptolemaeus in the 1st to 2nd century CE. It was an important town during the Middle Ages and served as the capital of the Shirvanshah state from the 8th to 15th centuries and capital of the independent Shirvan Khanate, also known as khanate of Shamakhi. The Catholic friar, missionary and explorer William of Rubruck passed there on his return journey from the Mongol Great Khan's court. In the middle of the 16th century it was the seat of an English commercial factory, under the traveller Anthony Jenkinson, afterwards envoy extraordinary of the khan of Shirvan to Tsar Ivan IV the Terrible of Russia. Adam Olearius, who visited Shamakhi in 1637, wrote: "Its inhabitants are in part Armenians and Georgians, who have their particular language; they would not understand each other if they did not use Turkish, which is common to all and very familiar, not only in Shirvan but also everywhere in Persia." The Russians first entered Shirvan in 1723 but soon retired leaving it to Ottomans who possessed it in 1723–35. In 1742 Shamakhi was taken and destroyed by Nadir Shah of Persia, who, to punish the inhabitants for their Sunnite creed, built a new town under the same name about to the west, at the foot of the main chain of the Caucasus Mountains. The new Shamakhi was at different times a residence of the Shirvan Khanate, but it was finally abandoned, and the old town rebuilt. In the mid-1700s, the population of Shamakhi was about 60,000, most of whom were Armenians. The Shirvan Khanate was finally annexed by Russia in 1805. The British Penny Cyclopaedia