and the city was not fully restored until 787/8, by Abu Sulaym Faraj on the orders of Caliph Harun al-Rashid (). Three thousand Khurasanis and 2,000 Syrians (a thousand each from Antioch and al-Massisa) were given houses and land in the new fortress city. Tarsus was apparently recovered by the Byzantines soon after, at some point around the turn of the century. The city probably remained in Byzantine hands during the Abbasid civil war of the Fourth Fitna, but returned to Muslim control by 830 when Caliph al-Ma'mun () recommenced offensive campaigns against Byzantium using the city as a base. Henceforth and until the Byzantine reconquest in the 10th century, Tarsus was one of the main centres for the holy war (jihād) against Byzantium, comprising annual raids (ṣawāʿif) into Byzantine lands through the Cilician Gates when the mountain snows had melted and passage was possible. These raids were mounted by the local garrisons, maintained by the taxation not only of the frontier zone of the al-ʿAwāṣim but also by generous subsidies from the caliphal government, and large numbers of volunteer warriors of the faith (mujahidun or ghazis). Tarsus remained under direct Abbasid control until 878/9, when it and the wider Cilician border zone were given to the autonomous ruler of Egypt, Ahmad ibn Tulun. The local governor Yazaman al-Khadim returned the city to the direct allegiance of Baghdad from 882 on, but was forced to recognise the Tulunids again in 890. Tulunid possession of the border zone lasted until the death of Ibn Tulun's heir Khumarawayh in 896, after which Caliph al-Mu'tadid () re-asserted direct control. The area remained under Abbasid rule for the next four decades. After a brief period when the border zone was under Ikhshidid control, in 946/7, Tarsus recognised the overlordship of the Hamdanid emir Sayf al-Dawla of Aleppo, who had become the new master of northern Syria and the Byzantine borderlands. Facing a resurgent Byzantium, he was able to stem the tide for a while, but in 965,the Byzantine emperor Nikephoros II Phokas () captured the city, ending Muslim rule there. Throughout this period, the governors of Tarsus also operated an active mint in the city. The terms of the city's surrender allowed any Muslim who wished to leave with as many of his possessions as he could carry. Many of those who left eventually settled, according to al-Muqaddasi, at Baniyas. Most of those who