Afsharid dynasty
The original building of the "Aali Qapu" palace was built in the late Safavid era, when Tabriz was capital of the Iranian Empire. This building was built in competition with Ottoman Empire, while two states were sworn enemies of each other. In later years during Afsharid dynasty and Zand dynasty, the palace was used as the palace for local governor of Azerbaijan.