First reign The Fatimid state, guided by al-Jarjara'i, had grown afoul of al-Dizbari's virtual independence and consolidation of power across Syria. Al-Jarjara'i condemned al-Dizbari as a traitor and much of the Fatimid army in Syria abandoned him. He was ultimately forced to leave Damascus for Aleppo, prompting al-Jarjara'i to request that Thimal neutralize him. Moreover, Thimal was formally granted by the Fatimid caliph
al-Mustansir () the governorship of Aleppo. By the time Thimal mobilized his Kilabi and other Bedouin forces from al-Raqqa to seize Aleppo, al-Dizbari died in January 1042. However, Thimal and Muqallid's troops were refused entry into the city by the
aḥdāth (urban militia) supported by the Fatimid garrison whose troops defied al-Mustansir's decree. Thimal retreated to the Kilabi tribal encampments at
Qinnasrin, but within a few days an opportunity arose to take Aleppo when the
aḥdāth and the Fatimid troops entered into conflict over control of the city. The
aḥdāth consequently allowed Thimal entry on 22 February, forcing the Fatimid troops to barricade themselves in a palace adjacent to the citadel, which was held by al-Dizbari's former
ghilmān (slave soldiers). Thimal was able to quickly capture the palace, but only captured the citadel after a seven-month siege, after which he was congratulated by al-Mustansir. During his siege of the citadel, Thimal sent envoys to Empress
Theodora () to gain Byzantine protection in return for recognizing Theodora' suzerainty and offering tribute. Theodora accepted and bestowed upon Thimal the title of
magistros, while conferring lower-ranking imperial titles on al-Sayyida al-Alawiyya and six other members of the Mirdasid household. Thimal thus became a vassal of Byzantium in the same way Nasr had been. In Zakkar's estimation, Thimal had been motivated to seek Byzantine protection out of fears that the Fatimids would at one point or another turn against him. Though al-Mustansir confirmed Thimal's governorship in 1045, tensions between Thimal and al-Mustansir increased when the former only partially restored to the Fatimids the 400,000 or 600,000 dinars left in Aleppo's citadel by al-Dizbari. Further straining ties was Thimal's discontinuation of the annual 20,000 dinar tribute to al-Mustansir. In 1048, al-Mustansir dispatched an army led by the Fatimid governors of Damascus and Homs,
Nasir al-Dawla ibn Hamdan and Ja'far ibn Kulayd, respectively, along with auxiliaries from the Banu Kalb, to conquer Aleppo. The Fatimid force captured Hama and
Ma'arrat al-Nu'man before defeating Thimal outside of Aleppo, forcing the latter to retreat behind the city walls. In the fall of 1048, Ibn Hamdan encamped his forces at Shildi, a village on the
Quwayq River in Aleppo's vicinity for the dual purpose of remaining close to the city and having access to a water supply for his troops. However, he was forced to Damascus as a result of heavy losses in men and equipment incurred when the Quwayq flooded his camp during heavy rains. Due to these natural events, Thimal was spared a potential Fatimid siege. During the 1048 Fatimid campaign, Thimal, suspicious of the loyalties of Aleppo's notable class, detained several notables, including the qadi Ibn Abi Jarada, and personally executed one of them. Following Ibn Hamdan's withdrawal, Thimal attempted to negotiate a peace with al-Mustansir through the latter's successive Jewish viziers, Sadaqa ibn Yusuf al-Falahi and Abu Sa'd, but both were executed in relatively quick succession. His cousin, Ja'far ibn Kamil, meanwhile went on the offensive and killed Ibn Kulayd at
Kafartab, provoking a renewed Fatimid expedition against the Mirdasids. This campaign was led by
Rifq at the head of a 30,000-strong army including an uneasy mix of regular
Berber troops and Bedouin auxiliaries from the Banu Kalb and
Banu Jarrah. The Byzantine emperor unsuccessfully attempted to persuade al-Mustansir to halt the advance and consequently dispatched two armies to oversee developments in northern Syria. To prevent their utilization by the Fatimids, Muqallid demolished the fortifications of Ma'arrat al-Nu'man and Hama. In August 1050, Rifq's forces were annihilated by Thimal's Kilabi troops at Jabal Jawshin and Rifq was detained and fatally wounded. After his victory, Thimal sought to avoid further conflict and achieve reconciliation with the Fatimids. To that end, he released all their war prisoners and entered into a mediation brokered by the Fatimid
qāḍī (judge) of
Tyre, Ali ibn Iyad. The latter persuaded al-Mustansir to accept a Mirdasid delegation headed by al-Sayyida al-Alawiyya and including Thimal's young son, Waththab, in late 1050. The delegates paid the caliph 40,000 dinars, which amounted to two years of unpaid tribute. Al-Sayyida al-Alawiyya declared the Mirdasids' loyalty to the Fatimids and beckoned al-Mustansir to "grant peace and protection" to Aleppo. Al-Mustansir subsequently confirmed Thimal's authority over Aleppo and the other territories of his realm. The peace with the Fatimids contributed to the stability of Thimal's emirate for the next seven years. During this time, Thimal's
shaykh al-dawla (chieftain of the state), Ibn al-Aysar, oversaw municipal affairs in Aleppo and was Thimal's principal representative with the Byzantine emperor and the Fatimid caliph. Annual tributes to both rulers were maintained. Unlike his Mirdasid predecessors who relied on Aleppine Christians as their viziers, Thimal entrusted fiscal policy to a succession of viziers from his old powerbase al-Rahba, as well as
Mosul: Abu'l Fadl Ibrahim al-Anbari,
Abu Nasr Muhammad ibn Jahir and Hibat Allah ibn Muhammad al-Ra'bani al-Rahbi. The latter two were "experts in public finance", according to Bianquis, and had served other Muslim rulers. The inhabitants of Aleppo generally prospered during this period and benefitted from low prices. The city experienced a construction boom in houses, most of which survived until the
Mongol destruction of Aleppo in 1260.
Vacating the emirate In 1057 and 1058, several domestic and external pressures caused Thimal's rule to become untenable. Among these was a severe drought and failed harvest in the emirate, a new state of war between the Fatimids represented by their expeditionary commander in Syria,
Ibn Mulhim, and the Byzantines, and military pressure by
al-Basasiri against Aleppo from the east. Thimal's inability to satisfy the financial demands of his tribesmen, the foundation of Mirdasid power, and his conflict with his brother
Atiyya, who was based in Balis, caused dissensions against him within the Kilab. The Fatimid vizier
al-Yazuri took advantage of Thimal's precarious position and apparent intention to vacate his emirate. The vizier sent the
qadi of
Tyre,
Ibn Aqil, to mediate with Thimal and facilitate his departure. In the ensuing agreement, Thimal stepped down on 23 January 1058 and the Fatimids compensated him with the governorships or appendages of the coastal towns of
Acre,
Beirut, and
Jubayl (Byblos). Ibn Mulhim subsequently became the Fatimid governor of Aleppo. Thimal's rule over the three coastal towns was evidently a tributary arrangement, as he did not exercise control over them and took up residence in Cairo with the blessing of al-Mustansir.
Second reign In September 1060, Thimal's nephew,
Mahmud ibn Nasr, captured Aleppo from Ibn Mulhim, after
defeating a Fatimid expeditionary force led by Nasir al-Dawla ibn Hamdan. In response, Caliph al-Mustansir stripped Thimal of his holdings along the Syrian coast, to which Thimal protested, claiming his innocence of the affairs in Aleppo. He accepted a proposal by the caliph to recognize him as emir of Aleppo once again in return for ousting Mahmud. Thimal departed Cairo and upon reaching Homs, summoned the Kilab to support him. A large part of the tribe heeded his call and marched with him to the gates of Aleppo, which he reached in January 1061. His initial siege was called off upon the arrival of Mahmud's Numayrid reinforcements and a smaller part of the Kilab, with whom Mahmud pursued Thimal and the rest of the Kilab. Thimal defeated Mahmud, who withdrew to Aleppo and appealed for the intervention of the Kilabi chiefs. The latter mediated an end to the fighting whereby Mahmud surrendered Aleppo to Thimal on 23 April in return for significant payment in cash and grain and a yearly salary. Thimal's second reign was marked by campaigns against the Byzantines and the Numayrids. Against the latter, who had taken control of al-Rahba, Thimal dispatched his brother Atiyya with a Kilabi troop to restore Mirdasid possession of the strategic town in August 1061. After Atiyya captured it, Thimal's Numayrid wife, al-Sayyida al-Alawiyya, reconciled Thimal and the Numayrids under
Mani ibn Waththab. While during his previous reign, Thimal had been an ally and practical vassal of the Byzantines, during his second reign he abandoned this policy in favor of the Fatimids. Zakkar theorizes that this was due to his lengthy stay in Cairo, where he may have come to realize the Fatimids were no longer capable of organizing a serious military campaign against Aleppo, and the Byzantines' preoccupation with
Seljuk inroads into Anatolia and Byzantium's possible support for Mahmud in the 1060 fighting. When the Byzantines restored a string of fortresses north of Aleppo around January 1062, Thimal considered this a threat and moved against a Byzantine army at the fortress of
Artah in May, which he defeated. Afterward, the Byzantines agreed to dismantle the new fortifications and pay Thimal an annual sum. The Byzantines reneged within a few months and their governor of
Antioch conspired with some elements of the Aleppine
ahdath against Thimal. The plot was uncovered and prompted Thimal to engage the Byzantines in two small skirmishes in October 1062. ==Death and aftermath==