Abu Hafs Umar bin Yahya (Arabic: أبو حفص عمر) (also known as Al-Mustansir II) was the Hafsid caliph of Ifriqiya (1284–1295).
[1][2] After restoring Hafsid rule interrupted by the usurper Ibn Abi Umara (1283–1284), Abu Hafs Umar sought to rebuild the state in the face of invasions and challenges to his authority.
During the period when the Hafsids had been driven out of Tunis by Ibn Abi Umara, Zakariyya, a nephew of Abu Hafs Umar I, conquered Bejaïa with the support of local tribes and later also gained control of Constantine.
[3]: 88–89 Surviving the battle of Marmājanna in June 1283 where most of his male relatives were killed by the usurper Ibn Abi Umara, Abu Hafs Umar took refuge in the fortress of Kalaat es Senam nearby.
[3]: 88 The new caliph did not pursue reprisals against those who had backed Ibn Abi Umar, but left them in peace, or in some cases appointed them to important positions in his own government.
Breaking with tradition he rewarded his Bedouin supporters with grants of land, increasing their economic and political power; previous rulers had given them only money.