Although Ayyub was Dawud's prisoner, the two now allied against al-Adil in Egypt, which Ayyub seized in 1240. In Damascus, Isma'il recognized the threat of Dawud and Ayyub against his own possessions, and turned to the crusaders for assistance. Theobald concluded a treaty with Isma'il, in return for territorial concessions that restored Jerusalem to Christian control, as well as much of the rest of the former kingdom, even more territory than Frederick had recovered in 1229. Theobald, however, was frustrated by the Lombard War, and returned home in September 1240. Almost immediately after Theobald's departure, Richard of Cornwall arrived. He completed the rebuilding of Ascalon, and also made peace with Ayyub in Egypt. Ayyub confirmed Isma'il's concessions in 1241, and prisoners taken at Gaza were exchanged by both sides. Richard returned to Europe in 1241.