Damietta against the Crusaders. In 1219 he was almost overthrown by a conspiracy led by the amir Imad ad-Din ibn al-Mashtub, commander of the Hakkari Kurdish regiment, to replace him with his younger and more pliant brother al-Faiz Ibrahim. Alerted to the conspiracy, Al-Kamil had to flee the camp to safety and in the ensuing confusion the Crusaders were able to tighten their grip on Damietta. Al-Kamil considered fleeing to Yemen, which was ruled by his son al-Mas'ud Yusuf, but the timely arrival of his brother Al-Muazzam from Syria with reinforcements brought the conspiracy to a swift end. Al-Kamil made many offers of peace to the Crusaders, all of which were rejected, due to the influence of the papal legate Pelagius. He offered to return Jerusalem and rebuild its walls (which his brother had torn down earlier in the year), and to return the True Cross (which he probably did not have). At one point he even met with Francis of Assisi, who had accompanied the crusade. Their meeting became a subject for painters like Giotto, Taddeo di Bartolo and Taddeo Gaddi. Due to famine and disease after the Nile failed to flood, al-Kamil could not defend Damietta and it was captured in November 1219. The sultan withdrew to al-Mansourah, a fortress further up the Nile. After this there was little action until 1221, when al-Kamil offered peace again, proposing to surrender the entire territory of the Kingdom of Jerusalem, except Transjordan, in return for the Crusaders evacuating Egypt but was again refused. The Crusaders marched out towards Cairo, but al-Kamil simply opened the dams and allowed the Nile to flood, and finally the Crusaders accepted an eight-year peace. He retook Damietta in September. Power struggle and the treaty of 1229 In the following years there was a power struggle with his brother al-Mu'azzam, and al-Kamil was willing to accept a peace with emperor and King of Sicily Frederick II, who was planning the Sixth Crusade. Al-Mu'azzam died in 1227, eliminating the need for a peace, but Frederick had already arrived in Palestine. After al-Mu'azzam's death, al-Kamil and his other brother al-Ashraf negotiated a treaty, giving all of Palestine (including Transjordan) to al-Kamil and Syria to al-Ashraf. In February 1229 al-Kamil negotiated the Treaty of Jaffa, a ten-year peace with Frederick II and returned Jerusalem and other holy sites to the Crusader kingdom. The treaty of 1229 is unique in