Tancred, Prince of Galilee, took it in 1108, but in 1114 the Crusaders lost it definitively to the Seljuks, during the reign of Toghtekin, atabeg of Damascus. The governor of Hama in the early 12th century was Ali Kurd, and his sons, Nasir and Kurdanshah became vassals of Toghtekin. In 1157 an earthquake shattered the city. For the next sixty years, Hama was battled for by competing rulers. Nur al-Din, the Zengid sultan, erected a mosque with a tall, square minaret in the city in 1172. In 1175, Hama was taken from the Zengids by Saladin. He granted the city to his nephew, al-Muzaffar Umar, four years later, putting it under the rule of his Ayyubid family. This ushered in an era of stability and prosperity in Hama as the Ayyubids ruled it almost continuously until 1342. Geographer Yaqut al-Hamawi, who was born in Hama, described it in 1225 as a large town surrounded by a strongly built wall. Hama was sacked by the Mongols in 1260, as were most other Syrian cities, but the Mongols were defeated that same year and then again in 1303 by the Mamluks who succeeded the Ayyubids as rulers of the region. Hama briefly passed to Mamluk control in 1299 after the death of governor al-Mansur Mahmoud II. However, unlike other former Ayyubid cities, the Mamluks reinstated Ayyubid rule in Hama by making Abu al-Fida, the historian and geographer, governor of the city and he reigned from 1310 to 1332. He described his city as "very ancient... mentioned in the book of the Israelites. It is one of the pleasantest places in Syria." After his death, he was succeeded by his son al-Afdal Muhammad who eventually lost Mamluk favor and was deposed. Thus, Hama came under direct Mamluk control.