Agha Mohammad Khan's choice of his capital was based on a similar concern for the control of both northern and southern Iran. He was aware of the loyalties of the inhabitants of former capitals Isfahan and Shiraz to the Safavid and Zand dynasties respectively, and was wary of the power of the local notables in these cities. Thus, he probably viewed Tehran's lack of a substantial urban structure as a blessing, because it minimized the chances of resistance to his rule by the notables and by the general public. Moreover, he had to remain within close reach of Azerbaijan and Iran's integral northern and southern Caucasian territories—at that time not yet irrevocably lost per the treaties of Golestan and Turkmenchay to the neighboring Russian Empire—which would follow in the course of the 19th century.