The Christian world's response to the loss of Jerusalem came in the Third Crusade of 1190. After lengthy battles and negotiations, Richard the Lionheart and Saladin concluded the Treaty of Jaffa in 1192 whereby Christians were granted free passage to make pilgrimages to the holy sites, while Jerusalem remained under Muslim rule. In 1229, Jerusalem peacefully reverted into Christian control as part of a treaty between Holy Roman Emperor Frederick II and Ayyubid sultan al-Kamil that ended the Sixth Crusade. In 1244, Jerusalem was sacked by the Khwarezmian Tatars who decimated the city's Christian population, drove out the Jews and razed the city. The Khwarezmians were driven out by the Ayyubids in 1247. In 1258, the Mongols destroyed Baghdad, killing hundreds of thousands. For the next 30 years, the area was the frontier between Mongol invaders (occasional Crusader allies) and the Mamluks of Egypt. The conflict impoverished the country and severely reduced the population. Sultan Qutuz of Egypt eventually defeated the Mongols in the Battle of Ain Jalut ("Goliath's spring" near Ein Harod), ending the Mongol advances, and his successors eliminated the Crusader states. The last Crusader state, the Kingdom of Acre, fell in 1291, ending the Crusades.