Khaydhar ibn Kawus al-Afshin
Ḥaydar ibn Kāwūs (, ), better known by his hereditary title of  al-Afshīn (, ), was a senior general of Sogdian Iranian descent at the court of the Abbasid caliphs and a vassal prince of Oshrusana. He played a leading role in the campaigns of Caliph al-Mu'tasim, and was responsible for the suppression of the rebellion of Babak Khorramdin and for his battlefield victory over the Byzantine emperor Theophilos during the Amorium campaign. Eventually he was suspected of disloyalty and was arrested, tried and then executed in June 841. Name and family background

Afshin is a hereditary title of Oshrusana princes at the time of the Muslim conquest of Persia. The term is an Arabic form of the Middle Persian Pishin and Avestan Pisinah, a proper name of uncertain etymology. Minorsky suggests that the title Afshin was of Sogdian origin. At the time of the first Arab invasion of Transoxiana (including Oshrusana) under Qutayba ibn Muslim (94-5 AH/712-14 CE), Ushrusana was inhabited by Iranians, who were ruled by their own princes who bore the traditional title of  Afshin. Afshin is generally considered an Iranian, and although two classical sources (and some modern authors) have called him a Turk. He came from an Iranian cultural region and was not usually considered Turkish. The confusion comes from the fact that the term “Turk” was used loosely by Arab writers of the time to denote the new troops of the caliph despite the inclusion among them of some elements of Iranian origin, including Ferghana and Oshrusana. His background has been stated to be Sogdian (an Eastern Iranian people). Early years 
According to Yaqubi, during the reign of the third Abbasid caliph Al-Mahdi (775-85), Afshin of Oshrusana was mentioned among several Iranian and Turkish rulers of Transoxania and the Central Asian steppes who submitted nominally to him. But it was not until Harun al-Rashid's reign in 794-95 that al-Fadl ibn Yahya al-Barmaki led an expedition into Transoxania and received the submission of Afshin Kharākana, the ruling Akin. Further expeditions were sent to Oshrusana by Al-Ma'mun when he was governor in Merv and later after he had become caliph. Kawus ibn Kharakhuruh, the son of the Afshin Karākana, withdrew his allegiance from the Arabs. However,  shortly after Ma'mun arrived in Baghdad from the east (817-18 or 819-20), a power struggle and dissension broke out among the reigning family of Oshrusana. According to most of the sources, al-Ma'mun's heir, Al-Mu'tasim seconded high-ranking officers to serve under him and ordered exceptionally large salaries, expense allowances, and rations for him. In 831-833, Afshin suppressed uprisings throughout Egypt. On 2 June 832 Afshin succeeded in taking Bima in Egypt. The town surrendered to Afshin following his advice that al-Ma'mun promised safe conduct. Afshin and Babak

In 835, Caliph al-Mu'tasim appointed Afshin as governor of Adharbayjan to fight against Babak Khorramdin, leader of anti-Islamic neo-Mazdakite Persian movement of the Khurramites. After a fierce resistance by Babak's army, Afshin eventually defeated it and captured Babak's castle of Bazz in August 837. Ya'qubi (Tarikh II, 579) records Afshin freeing 7,600 Arab prisoners from this fortress and he destroyed the castle. The Khurramite leader went into hiding under the protection of a local Christian prince Sahl ibn-Sunbat who later turned him into Afshin. In return for Afshin's achievements, the caliph rewarded him with the governorship of Sind in addition to that of Armenia and Adharbayjan. Amorium campaign 

In 838, al-Mu'tasim decided to launch a major punitive expedition against Byzantium, aiming to capture the two major Byzantine cities of central Asia Minor, Ancyra and Amorium. The latter was probably the largest city in Asia Minor at the time, as well as the birthplace of the reigning Amorian dynasty and consequently of particular symbolic importance; according to the chronicles, al-Mu'tasim's soldiers painted the word "Amorium" on their shields and banners. A vast army was gathered at Tarsus (80,000 men according to Treadgold), which was then divided into two main forces. Afshin was placed in command of the northern force, that would invade the Armeniac theme from the region of Melitene, joining up with the forces of the city's emir, Omar al-Aqta. The southern, main force, under the Caliph himself, would pass through the Cilician Gates into Cappadocia and head to Ancyra. After the city was taken, the Arab armies would join and march to Amorium. Afshin's force included, according to Skylitzes, the entire Arab army of Armenia, and numbered 20,000 (Haldon) to 30,000 men (Treadgold), among whom were some 10,000 Turkish horse-archers. In mid-June 838, Afshin crossed the Anti-Taurus Mountains and encamped at the fort of Dazimon, between Amaseia and Tokate, a strategically important location which the Byzantines also used as a forward staging area. A few days later, on 19 June, the vanguard of the main Abbasid army also invaded Byzantine territory, followed two days after by the Caliph with the main body. Emperor Theophilos chose to confront Afshin first, since although his army was smaller, it threatened to cut off his supply lines. On 21 July, the imperial army came into view of the Arab force, and encamped on the hill of Anzen south of Dazimon. In the ensuing Battle of Anzen, the Byzantine army attacked at dawn, and initially made good progress, but noon Afshin launched his Turkish horse-archers in a ferocious counter-attack which stymied the Byzantine advance and allowed the Arab forces to regroup. At the same time, Theophilos decided to lead reinforcements to one of his wings, and his sudden absence disquieted his troops, thinking he had been killed. The Byzantine army collapsed, with some units breaking and fleeing disorderly, while others were apparently able to retreat in good order. Theophilos himself barely escaped the battle with his guard, and was surrounded by Afshin's men on  a low hill. Afshin sent for catapults to be brought up to batter the Byzantine position, but the Byzantines managed to break through the Arab lines and the Emperor escaped. The caliph's vanguard under Ashinas reached Ancyra, which had been abandoned by its inhabitants, on 26 July. Afshin arrived there a few days later, and united with the main Abbasid army, which now turned south towards Amorium. Afshin commanded the rear guard, while Ashinas was once again in front, and the caliph in the middle. Looting the countryside as they advanced, they arrived before Amorium seven days after their departure from Ancyra, and began their siege of the city on 1 August. The city's fortifications were strong, with a wide moat and a thick wall protected by 44 towers, according to the contemporary geographer Ibn Khordadbeh, and the caliph assigned each of his generals to a stretch of the walls. Both besiegers and besieged had many siege engines, and for three days both sides exchanged missile fire while Arab sappers tried to undermine the walls. According to Arab accounts, an Arab prisoner who had converted to Christianity defected back to the caliph, and informed him about a place in the wall which had been badly damaged by heavy rainfall and only hastily and superficially repaired due to the city commander's negligence. As a result, the Arabs concentrated their efforts on this section. The defenders tried to protect the wall by hanging wooden beams to absorb the shock, but they splintered, and after two days a breach was made. The Arabs now launched repeated attacks on the breach, with Afshin, Ashinas, and Itakh taking turns in leading their men in attack, but the defenders held firm. In the event, the city fell by treachery in mid-August, when the Byzantine officer commanding the breach tried to open up separate negotiations with al-Mu'tasim, and the Abbasids used the lull in order to launch a surprise attack. Downfall 
Despite his successes, Afshin's star began to decline, apparently as a result of his jealousy towards `Abdallah bin Taher, the governor of Khorasan who Afshin apparently regarded as an upstart and a rival for power in Transoxania. Afshin had begun intriguing with Mazyar, a Karenid prince and ispahbadh of Tabaristan in the Caspian region. Afshin allegedly encouraged Mazyar in secret, in the hope that `Abdallāh bin Tāher would be deprived of his governorship allowing Afšīn to take over the governorship. Mazyar's rebellion was quashed in 839 and Afshin's position became increasingly difficult, which caused Afshin to fall from favour. His situation was made worse by the finding of correspondence between him and Mazyar. Further, the Khurasanian governor, Abdallah ibn Tahir, alleged that he had intercepted some of Babak's wealth Afshin had obtained in the earlier campaign and was seeking to transfer secretly to Afshin's lands in Oshrusana. When Mazyar arrived in Samarra, Afshin was arrested. Mazyar participated in the interrogation of the former general, asserting that Afshin had conspired with him. Others present raised additional questions concerning the sincerity of Afshin's conversion to Islam from Zoroastrianism. He said There is no God but God! to Al Wathiq. Afshin had answers to all the allegations. He claimed that Zoroastrian artefacts and books in his possession were family heirlooms from before he had become Muslim. He explained that when he punished a pair of Muslim fanatics destroying idols in Ushrusanah he was exercising reasonable leadership aimed at maintaining the harmony of his religiously diverse territory. He told his detractors that the formulaic address his people used in writing to him in Persian as "lord of lords", was simply a tradition and did not invalidate his personal belief in one God. All such replies were unsuccessful. Al-Mu'tasim had a special prison built for Afshin. It was known as "The Pearl" and was in the shape of a minaret. There he spent the final nine months of his life and there he died in May–June 841. The Tigris river was used as a dumping ground for his cremated remains. A single location was used for the crucifixion of Afshin, Maziyar, and Babak's corpses. After his death Ustrushana was Islamified whereas before he preserved temples from ruin. See also
 Islamic conquest of Persia
 Islamization of Iran
 Babak Khorramdin
 Babak Castle
 Mazyar

References

Sources 
 

C. E. Bosworth,"Afshin", Encyclopedia Iranica
John Bagot Glubb, The Empire of the Arabs, Hodder and Stoughton, London, 1963
 E. de la Vaissière, Samarcande et Samarra. Elites d'Asie centrale dans l'empire Abbasside, Peeters, 2007  

Iranian generals
8th-century births
841 deaths
Abbasid people of the Arab–Byzantine wars
Generals of the Abbasid Caliphate
Prisoners and detainees of the Abbasid Caliphate
8th-century Iranian people
9th-century Iranian people
Azerbaijan under the Abbasid Caliphate
Sogdian people
8th-century people from the Abbasid Caliphate
9th-century people from the Abbasid Caliphate