Ottoman–Hotaki War (1722–1727)

The Ottoman–Hotaki War of 1722–1727 were a series of conflicts fought between the Ottoman Empire and the Afghan Hotaki dynasty, over control of all western and northwestern parts of Iran.

Background
The Hotakis were an Afghan tribe and dynasty that ruled very shortly over nowadays Afghanistan, some of Iran, parts of Turkmenistan, and western Pakistan from 1722 to 1729, after having taken opportunity of the heavily declining and plagued by civil strife and royal intrigues Safavid Dynasty of Persia. The Safavids, once the arch enemy and most powerful opponent of the Ottomans, had been severely declining since the late 17th century due to incompetent rulers and civil strife. The Hotaki dynasty was founded in 1709 by Ghilzai Pashtuns of Kandahar who led a successful revolution against their Safavid suzerains.

During the decline of the Safavid state, the Ottoman Empire (the rivals of the Safavids), and Russian empires, had taken advantage of Iran’s decadence to annex de facto a large number of frontier districts. Folling the Afghan invasion, the Russians under Peter I immediately launched the Russo-Persian War (1722-1723), capturing and securing Iran's northwestern territories for themselves, comprising parts of Dagestan, Azerbaijan, Baku, as well as several territories in contemporary northern mainland Iran, such as Gilan and Astrabad. The Ottomans invaded from the Safavids their neighbouring west, capturing swaths of Iran's western territories. By the Treaty of Constantinople (1724), Russia and the Ottomans agreed to divide the captured regions from Iran. In the meantime, posing as if he was the legitimate inheritor of the Iranian throne, Ashraf demanded restitution of all the annexed territories. The Ottomans took offense at this arrogance, as they saw it, and proceeded to sever relations and open hostilities in Azerbaijan in the spring of 1726. Since one of their declared war aims was to restore the Safavids as a client dynasty, Ashraf’s first response was to put Sultan Husayn, who was living in captivity at Isfahan, to death in the autumn of 1726. Then, after strengthening the city’s fortifications, he marched out to meet Turkish troops and defeated them at Khoramabad, south of Hamadan, on 20 November 1726. The Afghan victory over a greatly superior military opponent was largely due to infiltration of the Ottoman ranks by agents provocateurs who emphasized the common Sunni faith of the Turks and the Afghans, deplored the fratricidal war between them, and advocated alliance against their common enemies, the heretical Persians; this adroit tactic sapped the morale of the Turkish troops and procured the defection of the Kurdish cavalry. Preferring not to push onward, Ashraf opened negotiations which led to the signature of a peace treaty in October, 1727 (Treaty of Hamedan). The Afghans, having no earlier experience about diplomacy or ruling a nation, agreed with the treaty which confirmed Ottoman sovereignty over all the western and northwestern parts of Iran and, in return for Ashraf’s abandonment of his territorial claims, gave him official recognition as Shah of Persia with rights of minting coins and sending annual pilgrimage caravans to Mecca.

Aftermath
The great majority of Iranians still rejected the Afghan regime as usurping since the day they invaded. The dynasty lived under great turmoil due to bloody succession feuds and resultant waves of internal revolts that made their hold on power tenuous and exhausted the strength of the Isfahan-based central government. That paved way for the rise of the Iranian military general Nader Shah and subsequently the continued wars of the Persian Empire with their Ottoman arch rivals.