back all territories and retreat from the entire Caucasus and northern mainland Iran as according to the Treaty of Resht (1732) and Treaty of Ganja (1735) during the reign of Anna of Russia. The terms of the treaty also included the first instance of close Russo-Iranian collaboration against a common enemy, in this case the Ottoman Turks. Relations sooned soured, however, after Nader Shah accused the Russians of conspiring against him. The invasion of Dagestan in 1741 was partially directed against Russia; thus the Terek River was left on a high state of alert until Nader Shah's death. Karim Khan Zand promised the Russians certain territories in the northern frontier if they helped him against enemies like the Ottomans. Qajar Persia–Russian Empire Irano-Russian relations particularly picked up again following the death of Nader Shah and the dissolution of his Afsharid dynasty which gave eventually way to the Qajarid dynasty in the mid-18th century. The first Qajar Persian Ambassador to Russia was Mirza Abolhassan Khan Ilchi. After the rule of Agha Mohammad Khan, who stabilized the nation and re-established Iranian suzerainty in the Caucasus, the Qajarid government was quickly absorbed with managing domestic turmoil, while rival colonial powers rapidly sought a stable foothold in the region. While the Portuguese, British, and Dutch competed for the south and southeast of Persia in the Persian Gulf, the Russian Empire largely was left unchallenged in the north as it plunged southward to establish dominance in Persia's northern territories. Plagued with internal politics, the Qajarid government found itself incapable of rising to the challenge of facing its northern threat from Russia. A weakened and bankrupted royal court, under Fath Ali Shah, was forced to sign the notoriously unfavourable Treaty of Gulistan (1813) following the outcome of the Russo-Persian War (1804–1813), irrevocably ceding what is modern-day Dagestan, Georgia, and large parts of the Republic of Azerbaijan. The Treaty of Turkmenchay (1828) was the outcome of the Russo-Persian War (1826–1828), which resulted in the loss of modern-day Armenia and the remainder of the Azerbaijan Republic, and granted Russia several highly beneficial capitulatory rights, after efforts and initial success by Abbas Mirza failed to ultimately secure Persia's northern front. By these two treaties, Iran lost swaths of its integral territories that had made part of the concept of Iran for centuries. The area to the north of the Aras River, which included the territories of the contemporary nations