Agha Mohammad Khan defeated numerous rivals and brought all of Iran under his rule, establishing the Qajar dynasty. By 1794 he had eliminated all his rivals, including Lotf 'Ali Khan, the last of the Zand dynasty, and had reasserted Iranian sovereignty over the former Iranian territories in Georgia and the Caucasus. Agha Mohammad established his capital at Tehran, a village near the ruins of the ancient city of Ray (now Shahr-e Rey). In 1796 he was formally crowned as shah. Agha Mohammad was assassinated in 1797 and was succeeded by his nephew, Fath Ali Shah.