Al-Kamil, the sultan of Egypt, had proposed years earlier to hand Jerusalem over to Fredrick II if he would in return not invade Egypt with a Crusader army.
The Egyptian sultan, who had a rebellion in Syria on his hands, agreed to honour the old proposal. He handed Jerusalem to Frederick II along with a narrow corridor to the coast plus Nazareth, Sidon, Jaffa, and Bethlehem.
The Muslims retained control over the Temple Mount area of Jerusalem, the al-Aqsa Mosque and the Dome of the Rock. The Transjordan castles stayed in Ayyubid hands and Arab sources suggest that Frederick II was not permitted to restore Jerusalem's fortifications, although the Crusaders did in fact restore Jerusalem's defensive walls. The treaty also included a 10 year peace agreement and was finalised on the 18th of February 1229 CE.