Handhala ibn Safwan al-Kalbi arrived in Egypt around 720, in the company of his brother, Bishr ibn Safwan al-Kalbi, who had been appointed governor of Egypt by the Umayyad Caliph Yazid II. Hahdhala came as chief magistrate. When Bishr was appointed to take up the government of Ifriqiya in Kairouan in 721, Handhala was designated his successor in Egypt. Handhala continued as governor of Egypt until 724, when the new caliph Hisham arose to the throne and appointed his own brother, Muhammad ibn Abd al-Malik ibn Marwan as governor. After a series of failed Egyptian governors, Caliph Hisham decided to restore Handhala ibn Safwan as governor of Egypt in 737, replacing Abd al-Rahman ibn Khalid al-Fahmi.
Governor in Ifriqiya
In October, 741, in the course of the Great Berber Revolt in the Maghreb, the Ifriqiyan army, along with a Syrian force dispatched by the caliph, was destroyed by the Berbers at the Battle of Bagdoura. The governor Kulthum ibn Iyad al-Qasi perished in the field, his nephew and successor Balj ibn Bishr al-Qushayri was holed up with the remnant of the army in Spain, leaving the whole of Ifriqiya open to the advance of the Berber rebels. Not having any more forces at his disposal, the Umayyad Caliph Hisham quickly appointed Handhala ibn Safwan as governor of Ifriqiya, with supervisory authority over all the Maghreb and al-Andalus, and instructed him to take whatever forces he could gather to defend Ifriqiya and quash the Berber rebellion. Leaving Egypt in the hand of Hafs ibn al-Walid ibn Yusuf al-Hadrami, Handhala set out westwards in February 742, picking up additional forces from Barqa and Tripoli. He arrived in Kairouan around April, 742. The qadi of Ifriqiya, Abd al-Rahman ibn Oqba al-Ghaffari, had been managing the defense of Kairouan, and succeeded in fending off an attack by the Berber rebel army raised in southern Tunisia by the Sufrite leader Oqasha ibn Ayub al-Fezari. Handhala ibn Safwan arrived in Kairouan just as Oqasha was said to be mounting a new attack, in coordination with another large Berber army coming in from the west, led by Abd al-Wahid ibn Yazid al-Hawwari. The Berber rebel armies were to make junction in front of Kairouan, before launching their final attack on the city. Wasting no time, Handhala dispatched a cavalry force to slow down Abd al-Wahid's progress, and threw the bulk of his forces south, defeating Oqasha in a bloody battle at El-Qarn and taking him prisoner. But Handhala had taken a lot of losses himself, and now faced the unhappy prospect of Abd al-Wahid's gigantic army, said to be some 300,000, ostensibly the largest Berber army ever seen. Hurrying back, Handhala is said to have put the entire population of Kairouan under arms to bolster his ranks, before setting out again. In perhaps the bloodiest encounter in the Berber wars, Handhala ibn Safwan defeated the great Berber army of Abd al-Wahid ibn Yazid at El-Asnam in May 742, just three miles outside of Kairouan. Some 120,000-180,000 Berbers, including Abd al-Wahid, fell in the field of battle in that single encounter. Having saved Ifriqiya from the Berber rebellion, Handhala focused his attentions on al-Andalus, where a veritable internecine war was raging between Andalusian Arabs and the newly arrived 'Syrian' junds. In early 743, Handhala ibn Safwan dispatched his cousin Abu al-Khattar ibn Darar al-Kalbi as his deputy to Córdoba, taking over the government of al-Andalus and settling the quarrel. In 743–44, Handhala was kept busy putting out sporadic revolts in the hinterlands of Ifriqiya, and had little or no time to concentrate on recovering the westerly provinces of Morocco and bringing the Berber back under Umayyad rule. It is possible he may have succeeded in recovering some of the coastal cities, like Tangiers, for the Caliphate, but the bulk of Morocco and western Algeria remained under the sway of autonomous Berber tribal rulers. In 744, the Masmuda Berber tribes openly erected an independent state in 744, the Berghwata confederation, with their own 'prophet' and syncretist beliefs. The disorder following the death of caliph Hisham in 743 prevented Handhala receiving more assistance from the east. Sensing an opportunity to seize more power for themselves, local Ifriqiyan nobles raised mutinies in the Ifriqiyan garrisons against the Umayyad governor. In late 744 or early 745, Abd al-Rahman ibn Habib al-Fihri, scion of the illustrious Fihrid dynasty, raised a revolt in Tunis and proclaimed himself ruler of Ifriqiya. Although urged to fight the pretender, Handhala ibn Safwan decided that North Africa had seen enough war and bloodshed, and opted to abdicate rather than put up a fight. He returned to Damascus in February, 745, leaving Ibn Habib to usurp the government in Kairouan. Some chroniclers report that, at his departure, Handhala ibn Safwan laid a curse upon Ifriqiya, expressing his hope that the land which had treated him so ungratefully would be possessed by pestilence, famine and war. Ifriqiya did indeed experience a severe drought not long after and would descend into violent disorder for the next couple of decades.