Treaty of Gulistan
In 1808 the Russians, now led by general Ivan Gudovich, attacked the city once again; this attempt was repelled as well. By the Treaty of Gulistan (1813), which ended the 1804-1813 war, Iran lost most of its Caucasus territories; Erivan and Tabriz were now the main headquarters of the Iranian efforts to regain the territories lost to Russia.