Under the circumstances Turkey decided that it would be easier to prevent further advance by Russia into Iran by invading that country itself, forestalling its rival in Iran rather than invading Russia. Furthermore, the Porte was displeased with both factions in Iran. As a Sunni Muslim, Mahmud, the Afghan ruler of Isfahan, acknowledged the Sultan as Caliph, but he adamantly refused to recognize the suzerainty of the Sultan. The Porte apparently disliked Tahmasb Mirza, the son of the dethroned Shah Sultan Husayn, because he was a Shia Muslim, a “heretic Persian!” The Porte declared war on Tahmasb Mirza. Faced with Turkish hostility and eager to restore the throne to the Safavi dynasty, he sought the assistance of Russia. That country responded with enthusiasm and signed an agreement with him in September 1723. Russia promised to supply Tahmasb Mirza with arms for suppressing the Afghans and recovering the throne of Iran. In return for this assistance, Tahmasb Mirza agreed to cede to Russia the towns of Derbend and Baku and the provinces of Gilan, Mazandaran, and Astarabad. Upon hearing of this agreement the Porte complained about “the insidious, secret and illusory' action of Russia at a time when the Iranian problem still was the subject of negotiation with Turkey at Constantinople. The Russo-Turkish tension reached a new height and threatened war. Motivated by its desire to keep Turkey strong against Austria, France mediated for the second time and succeeded in averting a war. More important, the French conciliatory efforts produced an agreement between St. Petersburg and Constantinople in regard to their conflicting interests in Iran (Source: The Foreign Policy of Iran).