Dizkuh was a fortress in central Persia, located in the strategic route leading to Isfahan, capital of the Seljuq Empire. The historian Ibn al-Athirattributes the construction of the fortress to the Seljuq sultan Malikshah, but it is more likely that it dates back earlier, even as early as the pre-Islamic Sasanian period, and the Seljuq sultan simply rebuilt the castle which was near his capital. Since then, the name Shahdiz became more common. The castle gained its fame due to the activities of the Nizari Ismailis. The Ismailis were active in the Isfahan region in the 11th century, and the chief da'i of Persia and Iraq Abd al-Malik ibn Attash had established his headquarters at Isfahan. After Hassan-i Sabbah's capture of the Alamut Castle, Abd al-Malik ibn Attash's son, Ahmad ibn Abd al-Malik ibn Attash was encouraged to seize the castle. He posed as a schoolmaster and gradually converted the garrison force of the fortress, most of whom were of Daylami origin with Shiite tendencies. By 1100, he had seized the fortress and began its re-fortification similar to the other Ismaili castles of Persia. Ahmad began to collect taxes from nearby districts. He had reportedly converted 30,000 people in Isfahan. Shahdiz was strategically important as it guarded the main route to Isfahan, the Seljuq capital city. Its capture had been a major strategic success for the Nizaris.
In 1107, soon after gaining power, Seljuq sultan Muhammad I Tapar, son of Malikshah, began a campaign against the Nizari Ismailis, focusing on Shahdiz, besieging the fortress with a large force. In an attempt to lift the siege, Ahmad tried to involve the Ismaili sympathizers in the Seljuq camp and the Sunni religious scholars of Isfahan in a long religious debate, trying to convince them that the Ismailis are true Muslims, too, differing only in the matter of imamate; therefore, sultan's campaign is religiously illegitimate. The debate finally ended after a year and the siege continued. In another negotiation initiated by the Seljuq sultan, the Nizaris bargained for another fortress, but this negotiation was unsuccessful and ended with a fida'i attacking and wounding a particularly anti-Nizari commander '' of the Seljuq sultan. Later, an agreement was reached: part of the garrison to be given a safe passage to other Ismaili castles in Arrajan and Quhistan, and the remainder, around eighty men in all, who held only a wing of the fortress, was to surrender and then go toAlamut after receiving the news of the arrival of their fellow Ismailis. This news was received, but Ahmad refused to leave the fortress, apparently deciding to fight to the end. The Seljuqs attacked the fortress, and Ahmad and his small group of fighters defended themselves gallantly from tower to tower. Most of the Ismaili fighters were killed, while a few managed to escape. Ahmad was captured, while his wife committed suicide. Ahmad and his son were executed and their heads were sent to the Abbasid CaliphAl-Mustazhir in Baghdad. The castle was demolished by the Seljuq sultan, who feared its recapture by the Ismailis. Apparently, the Khanlanjan fortress, a nearby Ismaili stronghold, was also destroyed during this campaign. The Nizari Ismailis therefore lost their influence in the Isfahan region.