 The last Ayyubid ruler of Hama died in 1299 and Hama briefly passed through direct Mamluk suzerainty. However, in 1310, under the patronage of the Mamluk sultan al-Nasir Muhammad, Hama was restored to the Ayyubids under the well-known geographer and author Abu al-Fida. The latter died in 1331 and was succeeded by his son al-Afdal Muhammad, who eventually lost the favor of his Mamluk overlords. He was removed from his post in 1341 and Hama was formally placed under Mamluk rule.
