Background
Tahmasp was the son of Sultan Husayn, the Shah of Iran at the time.
Tahmasp was the son of Sultan Husayn, the Shah of Iran at the time.
When Husayn was forced to abdicate by the Afghans in 1722, Prince Tahmasp wished to claim the throne. From the besieged Safavid capital, Isfahan, he fled to Tabriz where he established a government. Russo-Persian War
In June 1722, Peter the Great, the then tsar of the neighbouring Russian Empire, declared war on Safavid Iran in an attempt to expand Russian influence in the Caspian and Caucasus regions and to prevent its rival, Ottoman Empire, from territorial gains in the region at the expense of declining Safavid Iran.
The Russian victory ratified for Safavid Irans" cession of their territories in the Northern, Southern Caucasus and contemporary mainland Northern Iran, comprising the cities of Derbent (southern Dagestan) and Baku and their nearby surrounding lands, as well as the provinces of Gilan, Shirvan, Mazandaran, and Astrabad to Russia per the Treaty of Saint St. Petersburg (1723).
Tahmasp also eventually gained the recognition of both the Ottoman Empire and Russia, each worried about the other gaining too much influence in Iran. By 1729, Tahmasp had control of most of the country.