Al-Muzaffar II Mahmud

However, as he lay dying some of the leading emirs decided to invite an-Nasir back to Hama to usurp the throne in place of his brother, in the hope that they would be able to exercise real control under his nominal rule.

None of the notables of Hama would support him in removing An-Nasir, and none of the other Ayyubid princes in Syria was interested in helping him, so he had to return to Egypt, where he was given an estate by Al-Kamil.

In November 1228 (Dhu’l Hijja 625) negotiations took place at Tell el-'Ajul near Gaza between Aa-Kamil and his rival al-Ashraf as they sought to agree a balance of power between them across the Ayyubid realms.

On 25 July 1229 (2 Ramadan 626), Al Kamil, in alliance with al-Mujahid of Homs, laid siege to Hama to remove Kilij Arslan and restore al-Muzaffar.

After a few days of siege, Kilij Arslan came out to negotiate, and eventually agreed to leave Hama in return for receiving the fortress of Montferrand near Baarin.

This led to bad relations between the emirs, and when al-Muzaffar joined al-Kamil of Egypt in a campaign to oust al-Mujahid, the tensions between them broke out into open conflict.

When al-Kamil died al-Mujahid attacked the territory of Hama, devastating the countryside and diverting both the River Orontes and the canals which irrigated the fields around the city.

In the diplomatic manoeuvres which followed the death of al-Kamil, the emir of Hama, Al-Muzaffar, allied himself with As-Salih Ayyub and persuaded him that he could usefully secure his position in Syria before attacking Egypt by removing Al-Mujahid from Homs.

In March 1239 (Sha’ban 636), As-Salih Ayyub set out with his forces to attack Homs, but soon after he received envoys from Egypt complaining of the rule of al-Adil II and urging him to come and take power himself.