Agha Mohammad established his capital at Tehran, a village near the ruins of the ancient city of Rayy. In 1796, he was formally crowned as shah. In 1797, Mohammad Khan Qajar was assassinated in Shusha, the capital of Karabakh Khanate, and was succeeded by his nephew, Fath-Ali Shah Qajar.