all to the south and west - but over time the city expanded to the north and the palace precinct ended up in the center of the later Safavid city. This probably happened after the royal court moved to Isfahan under Abbas I in 1596/7 (1005 AH). The Chehel Sotun pavilion is typically attributed to Tahmasp I, although this is not confirmed because there is no inscription. Shah Ismail II was enthroned here in 1576, with a grand reception held in its main hall on 22 August of that year. Mohammad Khodabandeh was probably also enthroned here, and Abbas I was also enthroned here in 1587/8 (996 AH). After Shah Abbas moved the capital to Isfahan in 1596/7 (1005 AH), Qazvin did not become a provincial capital. Instead, it was governed by a wazir, darugha, kalantar, and mustawfi appointed directly by the central government. Qazvin only became a provincial capital during the latter part of Shah Soltan Hosayn's rule in the early 1700s. Based on the small contingent assigned to its governor - 300 soldiers - it does not seem to have been considered an important province. The tumultuous final years of the Safavid dynasty had a negative impact on Qazvin. Its population decreased, which was at least partly because of a decline in commerce. In 1722, Qazvin surrendered to an Afghan force of 6,000 soldiers under Aman Allah Khan, but in January 1723 there was a popular uprising (or lūṭibāzār) against them in all quarters of the city, led by the kalantars. The Afghans lost 2,000 men and were forced to retreat to Isfahan. Then in 1726, Qazvin surrendered to the Ottomans on the condition that the Ottomans would not send troops to the city - which the Ottomans promptly disregarded and sent 12,000 troops along with their appointed governor Ali Pasha. The troops were soon driven out of Qazvin. Writing in 1744, the English travller Jonas Hanway wrote that a Persian merchant had told him that there had formerly been 12,000 houses in Qazvin, but by then there were only 1,100. Qajar era By the beginning of the 19th century, Qazvin was again starting to flourish as a center of trade. Commercial traffic on the Caspian Sea was growing, and Qazvin was one of the main centers of activity – in the words of one traveller in 1801, it was "the mart of all the commerce of the