Evidence suggests that the lower layers and foundations of the castle are of Byzantine origin. Later levels were added by the Nizari Ismailis, Mamluks, and Ottomans. The castle was captured by the Ismailis in 1141 from Sanqur (who had held it on behalf of the Banu Mundiqh of Shayzar) and was later refortified by Rashid al-Din Sinan. Masyaf and the surrounding town functioned as the capital of a Nizari emirate from the middle of the 12th century until the end of the 13th century. Saladin besieged it in May of 1176 but the siege did not last long and it concluded with a truce. Current research indicates it was held by the Assassins at that time.
In 1260, the castle was surrendered to the Mongols. Later that year in September, the Nizaris allied with the Mamelukes to drive the Mongols out from Syria and reclaim the castle. Baybars took hold of the castle in February of 1270. In 1830, an Ottoman expedition led by Ibrahim Pasha did some damage to the castle. Restoration funded by the Aga Khan Trust for Culture Historic Cities Support Programme began in 2000.