Abu Yahya Abu Bakr II

He was the son of Abu-Zakariyya Yahya III, emir of Béjaïa and grandson of Abu Ishaq Ibrahim I.

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.

[4]: 146–7, 150  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.

It was during this time that his subject, the famous traveller Ibn Battuta visited Tunis on his return journey from the Hajj pilgrimage.