Abu Yahya Abu Bakr II

Abu Yahya Abu Bakr II (أبو يحيى أبو بكر المتوكل) (died 19 October 1346) was the Hafsid caliph of Ifriqiya from 1318 to 1346. He was the son of Abu-Zakariyya Yahya III, emir of Bejaia and grandson of Abu Ishaq Ibrahim I. Under his rule the former unity of the Hafsid domains was restored.

Rise to power
After 1309 his brother Abu-l-Baqa Khalid An-Nasr came to power in Tunis and made him governor of Constantine. Shortly after this he revolted. In 1311 his brother was overthrown and Abu-Yahya Abu-Bakr seized the opportunity to take Bejaïa in 1312 with the new ruler of Tunis, Abd al-Wahid Zakariya ibn al-Lihyani, powerless to respond. In 1315 or 1316 the attacks on Tunis began; in 1317 al-Lihyaní fled the country and abdicated in favor of his son Abu-Darba Muhammad who resisted for another nine months, but in early 1318 Abu-Yahya Abu-Bakr II made his entrance into the capital.

Early challenges
The earlier part of his reign was largely devoted to suppressing rebellions. Abu-Darba tried to encourage revolts and also encouraged Ibn al-Imran, son-in-law of al-Lihyaní, to rebel. Until 1332 there were numerous rebellions but Abu-Yahya Abu-Bakr II was gradually able to restore control. To maintain the cohesion of his states he entrusted the government of the provinces from 1320 to his sons assisted by chamberlains. Between 1319 and 1330 the Zayyanids of Tlemcen attacked Hafsid territory every year until the threat was neutralised through an alliance with the Marinids of Fez, whose heir presumptive Abu-l-Hassan married Abu-Yahya Abu-Bakr's daughter.

Later rule
After 1330 the Almohad sheikh Ibn Tafragin ascended to the highest positions in the state, becoming chief chamberlain in 1343. From this position he favored the strengthening of relations with the Marinids and the rise of the influence of the Emir's son-in-law. Abu-l-Hassan was now Emir of Fez and the Hafsids’ immediate western neighbour, having annexed Tlemcen in 1337.

In 1335 Abu Yahya Abu Bakr regained Djerba from the Sicilians. One of the most significant developments of his rule was the establishment of corsair fleets in Hafsid ports, and from this period piracy began to be a significant source of income for the region.

Succession and Marinid invasion
In the Spring of 1342 Abu Yahya Abu Bakr designated as his successor one of his sons, Abu-l Abbas Ahmad, who governed the South, and confirmed with his son-in-law Abu'l Hassan that he would support him. However, when Abu Yahya Abu Bakr died in October 1346, it was another of his sons, Abu Hafs Umar, who happened to be in Tunis, and he with the support of Ibn Tafragin he had himself proclaimed caliph with the title al-Nasr li-din Allah. Abu-l Abbas Ahmad marched on Tunis from the south and took the city, but he was soon killed by Abu Hafs Umar, who also killed his other brothers to remove any other rivals.

As guarantor of the Hafsid succession, Abu'l Hasan invaded from Morocco in the Spring of 1347 to drive out the usurper. Abu Hafs Umar fled Tunis but was captured near Gabes and executed in August. Abu'l Hasan made a triumphal entry into Tunis in September. It was during this time that his subject, the famous traveller Ibn Battuta visited Tunis on his return journey from the Hajj pilgrimage. However the Black Death ravaged the Hafsid domains in 1349 and his government was not popular. There were soon rebellions against Marinid rule, forcing him to abandon Tunis by ship in December 1349. Early in 1350 the Hafsid prince Al-Fadl of Bejaia was proclaimed caliph, but in July Ibn Tafragin returned and raised his brother Abu Ishaq Ibrahim II in his place, putting Al-Fadl to death.