During the Safavid rule, from 1502 to 1722, Iran went through a period of relative calm and stability. Arg-e-Bam was considerably developed, as well as the rest of the country. The Four Seasons Palace was built during this period. Towards the end of the Safavid rule, Arg-e-Bam was conquered by the founder of the Qajar Dynasty, Agha Mohammad Khan, who used the citadel as a strategic point to fend off Afghan and Baluchi incursions and thus, turned it into a military complex. In 1839, Aga Khan I, Imam of the Nizari Ismaili sect, rose up against Mohammad Shah Qajar and took refuge in Arg-e-Bam, until Prince Firooz Mirza, who was later to be known as "Farman Farma" (the Ruler of Rulers), arrested him. The increasing military presence within the walls of Arg-e-Bam gradually led people to settle outside the limits of the ramparts. In 1880, Firooz Mirza wrote that only military personnel were residing within the citadel area and he suggested that the old and abandoned city sitting at the foot of the citadel be demolished and the area turned into a garden. In 1900, the construction of the new city of Bam began and people progressively left the old Bam.