The Crusader defeat at the Battle of Hattin leads to the end of the First Crusader Kingdom (1099–1187). During the Second Crusader Kingdom (1192–1291), the Crusaders can only gain a foothold in Jerusalem on a limited scale, twice through treaties (access rights in 1192 after the Treaty of Jaffa; partial control 1229–39 after the Treaty of Jaffa and Tell Ajul), and again for a last time between 1241 and 1244.