Ottoman–Hotaki War (1726–1727)

The Ottoman–Hotaki War of 1726–1727 was a conflict fought between the Ottoman Empire and the Hotak dynasty, over control of all western and northwestern parts of Iran.

Background
The Hotaki dynasty was founded in 1709 by the Ghilzais of Kandahar who led a successful revolution against their Safavid suzerains. They had gained control over parts of current Afghanistan and Iran from 1722 to 1729, after having taken advantage of the heavily declining, plagued by civil strife and royal intrigues, Safavid dynasty of Iran. 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.

During the decline of the Safavid state, the Ottoman and Russian empires had taken advantage of Iran's decadence to annex much of western Iran. During the Afghan invasion, the Russians under Peter I immediately launched a campaign against Iran, capturing and securing parts of Dagestan, Azerbaijan, and Gilan and having a claim on Astarabad due to the treaty of St. Petersburg. The Russian occupation sparked tensions between the Ottoman and Russian empires, as the Ottomans did not want the Russians to proceed into the now-Turkish province of Shirvan governed by Hajji Dawud. However, through negotiations between the two tensions were reduced and in June 1724 the Treaty of Constantinople was signed. Russia and the Ottomans agreed to divide the regions captured from Iran.

The Ottomans proceeded to launch a campaign against the Safavids in the northwest. In 1723 Ibrahim Pasha captured the city of Tiflis, although guerilla resistance in the province continued for quite some time. In the late spring of 1724, Ahmed Pasha marched towards the city of Erevan, and eventually capturing it on September 28, 1724. Abraham writes that it fell on the 7th of June, with the citadel falling on 20 August. Ganja was conquered in September. In the summer of 1724, Khoy, Quschi, Tasuj, and Marand were all conquered by the Ottomans in the summer of 1724. In August 1724 Ottoman forces besieged Tabriz but were forced to retreat to Tasuj on September 30. However, Ottoman forces were reinforced and eventually were able to capture Tabriz in August 1725.

Ottoman-Afghan Diplomacy
As Ottoman expansion into Persia continued, Ashraf Hotak, having recently toppled his brother, Mahmud Hotak from power, was claiming himself as the sole legitimate ruler of all Persia, and demanded that the Ottomans cede all their annexed territories. Ashraf also claimed himself as the Sunni caliph. The Ottomans saw this as a diplomatic insult, and broke off all ties, and declared war on the Afghans. One of the main goals of the Ottomans was to restore the Safavid dynasty as a vassal state to the throne. And as a result, Ashraf Hotak executed Soltan Hoseyn, the former Safavid king. War began as the Ottomans opened hostility in the Azerbaijan region in 1726.

War
The Ottomans mobilized a force of 50,000 or 300,000 strong at Baghdad with heavy artillery, and began his campaign against the Afghans. The Afghans in turn, mobilized a force of 15,000 to 20,000 men, but lacked artillery. Ahmad Pasha, the commander of the Ottoman army, divided the army into three split groups and sent them through different routes after arriving at Gazarabat, a small village. Due to the size of the army, it took 16 days for the entire army to re-group at Khromabad. Ahmad Pasha and the army continued his march toward Hamadan, and encamped at Lailas, near Gorovan upon arrival. Ahmad Pasha sent envoys to the Hotaks, but they were imprisoned, leading to Ahmad Pasha marching to meet the Afghans in battle. The Ottomans advanced as far as Maran, but did not see any sign of an Afghan army. Ahmad Pasha continued his advance to Kazalkend and Tarija, but still did not find any Hotak forces. Around six days after the Ottomans arrived, the Afghans amassed with an army and took to battle at Khorramabad on 20 November 1726. In the first engagement, the Afghans were driven off, as the battle continued In the second engagement, the Afghans defeated the Ottomans and in return, completely routed them, forcing them to flee to Hamadan.

Following these engagements, the Ottomans suffered a loss of morale, with rumors rising on how they were defeated, ranging from them being attacked by snakes with wings, to the sky pouring down flames upon the army, as well as claims that the Afghan Amir was using magic. In reality, however, the main reason was that the Ottomans and Hotaks were both Sunni, and many in the Ottoman army saw it wrong to fight another Sunni nation. Alongside this, the uncle of Ashraf Hotak, Mirwais Hotak, used the epithet Amir, and Ashraf Hotak had adopted the epithet of "Amir-Vais". When Turks heard the name, they were confused and believed that he was the Amir al-Mu'minin. As a result, the Ottoman forces were severely demoralized.

Outcome
Preferring to not push onward due to internal issues and the state of the Afghan army, Ashraf Hotak began negotiating a peace agreement. The Hotaks had obtained a military victory in this engagement against the Ottomans. Ashraf Hotak was also officially recognized as Shah, with the Ottomans corresponding him as the Shah of Iran. Alongside this, Pilgrimage caravans sent by the Afghans would be protected by the Ottomans. The Ottomans made political gains after successfully negotiating to keep their occupied lands. The Afghans withdrew from territories gained following their victories, with the Ottomans taking control of Zanjan, Soltaniyeh, and Abhar.

Aftermath
The war allowed Ashraf Hotak to unite and gain support from his Kurdish and Zoroastrian populations, and even Shia Shahsevan tribes. Nonetheless, the Afghans were still in great majority, seen as usurpers by the Iranian populace. As a result, this sparked internal revolts and weakened the strength of the Afghans and their administration based in Isfahan. And as a result, the rise of Nader Shah began. After numerous engagements, the Afghan armies were forced back on Isfahan, with them abandoning the city on 21 November 1729.