Emperor Frederick II had repeatedly vowed a crusade but failed to live up to his words, for which he was excommunicated by Pope Gregory IX in 1228. He nonetheless set sail from Brindisi, landed in Palestine, and through diplomacy he achieved unexpected success: Jerusalem, Nazareth, and Bethlehem were delivered to the crusaders for a period of ten years.
In 1229 after failing to conquer Egypt, Frederick II of the Holy Roman Empire, made a peace treaty with Al-Kamil, the ruler of Egypt. This treaty allowed Christians to rule over most of Jerusalem, while the Muslims were given control of the Dome of the Rock and the Al-Aksa mosque. The peace brought about by this treaty lasted for about ten years. Many of the Muslims though were not happy with Al-Kamil for giving up control of Jerusalem and in 1244, following a siege, the Muslims regained control of the city.