The war ended in 1828 following the occupation of Tabriz. The war had even more disastrous results for Persia than the 1804-1813 war, as the ensuing Treaty of Turkmenchay stripped Persia of its last remaining territories in the Caucasus, which comprised all of modern Armenia, the southern remainder of modern Azerbaijan, and modern Igdir in Turkey. Through the Gulistan and Turkmenchay treaties Persia lost all of its territories in the Caucasus to Russia. These territories had once extended throughout most of Transcaucasia and part of the North Caucasus.