When the news of Alamut fallen to Hasan bin Sabbah reached to the court of the Seljuq sultan Malikshah (455-485/1063-1092) and his vizir Nizam al-Mulk (408-485/1018-1092), they became highly perturbed, and began to hatch animosity against Hasan bin Sabbah. Malikshah held a series of meetings with his courtiers, and sent his deputation to Alamut, insisting Hasan bin Sabbah to confess the supremacy of the Seljuqids. Hasan bin Sabbah received the deputation with consideration and when they glorified the power and pomp of Malikshah and asked him to accept their supremacy, he told to them, "We cannot obey the orders of others except our Imam. The material glory of the kings cannot impress us." The deputation left Alamut of no avail, and at that time, Hasan bin Sabbah told to them last words, "Tell to your king to let us live at our cell in peace. We will be compelled to take arms if we are teased. The army of Malikshah has no spirit to fight with our warriors, who do not give importance to this little span of life." Thus, Malikshah and his vizir did not dare to attack on Alamut for two years.
Soon, Alamut came to be raided by the Seljuq forces under the command of the nearest military officer, and the governor of Rudhbar district, called Turun Tash. Von Hammer (1774-1856) writes in "History of the Assassins" (London, 1935, p. 78) that, "No sooner had Hasan Sabbah obtained possession of the castle of Alamut, and before he had provided it with magazines, than an amir (Turun Tash) on whom the sultan had conferred the fief of the district of Rudhbar, cut off all access and supplies." Since the stronghold could not be reduced by storm, the amir Turun Tash besieged it, devastated the fields and butchered the Ismaili converts. Within Alamut, the supplies and provisions were inadequate, its occupants were reduced to great distress, suggesting to abandon the fortress. There were some who looked upon it as a great hardship, thinking that they were being thrust into the very jaws of death. Hasan, however, persuaded the garrisons to continue resisting, declaring to have received an express and special message of Imam Mustansir billah from Cairo, who promised and portended them good fortune, and this is the cause that Alamut is also called Baldat al-Iqbal (the city of good fortune). Surrounded by a thick mist of disappointing circumstances, Hasan's eyes could yet perceive a ray of hope. Turun Tash directed many serious raids but shortly died. The starving garrisons, however, held out and the siege was broken. This was the first inimical operation against the Ismailis.
Malikshah, on getting the news of the rout of Turun Tash's armies completely lost his balance. In 484/1091, he visited Baghdad, which was his second visit after 479/1087, where he discussed with the Abbasids the measures of extermination of the Ismailis. He was bent upon striking the Ismailis at their very existence. His vizir Nizam al-Mulk, an ardent and ruthless enemy of the Ismailis, infused him to dispatch two big armies, one to Rudhbar, and the other to Kohistan. Thus, Malikshah made a determined effort to root out the Ismailis and launched an expedition early in 485/1092.
In the meantime, the vizir Nizam al-Mulk began to incite the people and employed the pens of theologians against Hasan bin Sabbah and his followers. He compiled "Siyasat-nama" (Book of the art of Politics), showing the strong anti-Shiite tendencies. Besides being what its title says, is also a valuable, though biased source for studying the history and doctrines of the Ismailis. Indeed the Shiite resentment was the principal cause of Nizam al-Mulk's murder in 485/1092. "It is said" writes Ibn Khallikan in his "Wafayat al-A'yan"(1st vol., p. 415) "that the assassin was suborned against him by Malikshah, who was fatigued to see him live so long, and coveted the numerous fiefs which he held in his possession." Ibn Khallikan also writes that, "The assassination of Nizam al-Mulk has been attributed also to Taj al-Mulk Abul Ghanaim al-Marzuban bin Khusaro Firuz, surnamed Ibn Darest; he was an enemy of the vizir and in high favour with his sovereign Malikshah, who, on the death of Nizam al-Mulk, appointed him to fill the place of vizir."
The Rudhbar expedition, led by Arslan Tash, reached Alamut in Jumada I, 485 and had a siege for four months. At the time, Hasan bin Sabbah had with him only 70 men with little provisions, and was on the verge of being defeated; when a seasonable succour of 300 men from Qazwin enabled him to make a successful sally. It was dai Didar Abu Ali Ardistani, who brought 300 men in Qazwin, who threw themselves into Alamut, bringing adequate supplies. The reinforced garrison routed the besiegers in a nocturnal assault on their camps at the end of Shaban, 485/October, 1092, forcing them to withdraw from Alamut. It must be known that the Seljuqs forces were well equipped with skilled veterans, while Alamut had recruited those young fidais who were not yet experts in warfare. Neither in respect of number, nor in that of strength and skill, were the Ismailis a match for their enemy. It indeed kindled the flame of enthusiasm that glowed hidden in the hearts of Hasan's followers. The spirit of deep-rooted faith and the directions of Hasan bin Sabbah, provided them a resistible fillip before such large hosts. Thus, the designs of their enemy were frustrated. This operation against Alamut dealt on the one hand a smashing blow to the Seljuqs, while on the other, it strengthened the root of Ismailism at Alamut. It is also said that Arslan Tash continued the siege for four months and did not see any Ismaili resident of the fortress at all except one day when his army sighted on the top of the fortress a man clad in white clothes, who watched the army for a while and disappeared.
On other hand, the Kohistan expedition under Qizil Sariq had concentrated to capture the Ismaili castle of Dara. Malikshah died shortly afterwards at the end of 485/1092, about 35 days after the murder of Nizam al-Mulk; resulting the pending Seljuq plans for further expeditions abandoned. At the same time, the expedition of Kohistan, which had absolutely failed to capture Dara, withdrew in the field.
Upon Malikshah's death, the Seljuq empire was thrown into civil war and internal wrangles, which lasted for more than a decade, marked by disunity among Malikshah's sons. The most prominent one was the eldest son Barkiyaruq, while Malikshah's four years old son Mahmud had immediately been proclaimed as sultan. Barkiyaruq was taken to Ray where he was also placed on the throne. Mahmud died in 487/1095, and the Abbasids recognized the rule of Barkiyaruq, whose seat of power was in Western Iran and Iraq. He fought a series of indecisive battles with his half-brother Muhammad Tapar, who acquired much help from his brother Sanjar, the ruler of Khorasan and Turkistan since 490/1097. The intestine Seljuq quarrels gave the Ismailis a respite to make Alamut as impregnable as possible. Hasan bin Sabbah strengthened the fortifications and built up a great store of provisions. He held a number of fortresses in Daylam besides Alamut and controlled a group of towns and castles in Kohistan extending north and south over 200 miles. The Ismailis occupied the fortresses of Mansurakuh and Mihrin to the north of Damghan, and Ustavand in the district of Damawand. They also took possession of one of the most important strongholds, Girdkuh in Qumis. Girdkuh, the old Diz Gunbadan (the domed fort) and its district was very fertile, known as Mansurabad. In 489/1096, the fortress of Lamasar was conquered under the command of Kiya Buzrug Ummid.
It is a point worth consideration that "Kitab al-Naqd" by Nasiruddin Abdul Rashid al-Jalil, speaking of the radical situation after the death of Malikshah in Ispahan that the manaqib-khwans, a group of Shiite singers who extolled the virtues of Ali and his descendants in the streets. To counterbalance the manaqib-khwans' influence, the Sunnite regime employed fada'il-khwans (singers of virtues), who exalted the virtues of Abu Bakr and Umar and insulted the Shiites. This created religious agitations in the Seljuqid empire.
According to "Seljuk-nama" (Tehran, 1953, p. 41), which was compiled in 580/1184 by Zahiruddin Nishapuri, "In 486/1093, the people of Ispahan apparently moved by a rumour that a certain Ismaili couple had been luring passers-by into their house and torturing them to death, rounded up all the Ismaili suspects and threw them alive into a large bondfire in the middle of the town." There are few other incidents that had been curiously coloured against the Ismailis in the Seljuqid sources. Carole Hillenbrand writes in "The Power Struggle between the Saljuqs and the Ismailis of Alamut" that, "The Sunni sources of the 6th/12th and 7th/13th centuries generally try to inflate the Saljuq achievement against the Ismailis of Alamut. This is especially the case with sultan Muhammad." (cf. "Mediaeval Ismaili History and Thought" ed. Farhad Daftary, New York, 1966, p. 216)
The sources at our disposal suggest that the sons of Malikshah, with the exception of Muhammad did not like to continue fighting with the Ismailis, but were compelled to do that in order to avoid the accusation of being conciliatory to the Ismailis. When Barkiyaruq bin Malikshah ascended in 487/1095, he did not show any enthusiasm for fighting with the Ismailis. On one occasion in 493/1100, when Barkiyaruq was fighting with his brother, he is said to have recruited 5000 Ismaili warriors into his army. The mob and the theologians accused Barkiyaruq of favouring the Ismailis, therefore he purged them from his forces, and at the end of his reign, he evoked harrowing persecution. In 494/1101, Barkiyaruq in Western Iran and Sanjar in Khorasan came to an agreement to regard the Ismailis as a threat to Seljuq power, and to act against them. He died in 498/1105 and Muhammad Tapar became the undisputed sultan, and Sanjar remained at Balkh as his viceroy in the east. With the advent of Muhammad, the dynastic disputes ended and the Seljuqs made greater headway against the Ismailis. He turned fiercely towards the Ismailis in 500/1107 to capture the fort of Shahdiz, lying on a mountain about 8 km. to the south of Ispahan, the capital of the Seljuq empire. In 494/1101, dai Ahmad bin Abdul Malik bin Attash had occupied the fort of Shahdiz and converted 30,000 persons in Ispahan, and made Shahdiz as the Ismaili mission centre for Fars as Alamut was the centre in Khorasan. When the fort of Shahdiz was stormed, the Ismailis were massacred mercilessly. He held out with about 80 men in what remained standing of the largely demolished fortress Shahdiz, who fought bravely and were killed. His wife, decked in jewels leaped over the wall to death, but did not submit. Dai Ahmad bin Abdul Malik was taken prisoner and paraded through the streets of Ispahan. He was mocked, pelted with stones and flayed alive. His son was also scourged to death. Another Ismaili fort, named Khanlanjan, about 30 k.m. south of Ispahan was also razed by the Seljuqs.
In 501/1108, Sultan Muhammad sent a military expedition to Alamut under the direction of his vizir, Ahmad bin Nizam al-Mulk. The fortress of Alamut was stormed, but the attack fissiled out and could not attain its end. But sultan Muhammad continued to be inimical to Ismailis. According to Bernard Lewis in "The Assassins" (London, 1967, p. 56), "The capture of Alamut by direct assault was clearly impossible. The sultan therefore tried another method - a war of attrition which, it was hoped, would weaken the Ismailis to the point where they could no longer resist attack." In 503/1109, the reduction of Alamut, therefore, was charged to Anushtagin Shirgir, the then governor of Sawa. He destroyed the crops in Rudhbar and besieged the fort of Lamasar and other castles for eight consecutive years. He also laid a siege over Alamut, inflicted a severe hardship on the Ismailis, forcing Hasan bin Sabbah and many others to send their wives and daughters to Girdkuh, where they were to earn their keep by spinning. He never saw them again, nor did he thereafter permit women to enter the castle. Hasan bin Sabbah had to ration the food among his men to a bread and three fresh walnuts for each person. Anushtagin Shirgir got regular reinforcement from the Seljuqid amirs of various districts. In 511/1118, when Anushtagin reared mangonels and was on the verge of reducing Alamut, whose garrison was almost exhausted by bombardment, and the provision was about to dwindle in three days, the news at once arrived of the death of sultan Muhammad. Hence, the Seljuq armies were obliged to lift the siege and left Rudhbar, paying no attention to Anushtagin's pleas to fight longer. He was also obliged to abandon his siege of Alamut, and lost many men while retreating. The Ismailis came into possession of all the supplies left behind by the Seljuq armies. Bundari compiled "Zubdatu'n Nasrah wa Nakhbatu'l Usrah" (ed. M.T. Houtsma, Leiden, 1889) in 623/1226 and writes that the Seljuqid vizir Qiwamuddin Nasir al-Dargazini, a secret Ismaili, may have played a seminal role in preventing the Seljuqid victory and in procuring the withdrawal of Anushtagin Shirgir's army from Rudhbar.
Sultan Muhammad's death was followed by another period of internal disputes in the Seljuqid empire, which provided the Ismailis a respite to recover from the severe blows and hardships inflicted upon them during last eight years. Sultan Muhammad was succeeded by his son Mahmud in Ispahan, who ruled for 14 years (511-525/1118-1131) over western Iran. He had to face with other claimants for the throne. In time, three other sons of sultan Muhammad, viz. Tughril II (526-529/1132-1134), Masud (529-547/1134-1152) and Suleman Shah (555-556/1160-1161), as well as several of his grandsons, succeeded to the sultanate in the west. Mahmud's uncle Sanjar, who controlled the eastern provinces since 490/1097, now became generally accepted as the head of the Seljuq family. In this capacity, Sanjar exercised a decisive role in settling the succession disputes. At the outset, Mahmud had to face an invasion by Sanjar, who defeated Mahmud at Sawa. But in the ensuing truce, Sanjar made Mahmud his heir, while taking from him important territories in northern Iran, Sanjar continued to dominate these territories. Meanwhile, Mahmud's brother Tughril rebelled and occupied Gilan and Qazwin.
As the power of Alamut increased, the hostility of the Seljuqs augmented in virulence, therefore, Sanjar also continued to follow footprints of his predecessors. He dispatched troops against them in Kohistan and himself moved against Alamut with a strong force. Hasan bin Sabbah tried sundry times to dissuade the sultan from his designs with much persuasion, appealing for peace, but all in vain. The menace and insolence of the Seljuqs forced Hasan bin Sabbah to order one of his fidais to fix a dagger on the side of the sultan's bed with a note around its hilt, which reads: "Let it not deceive you that I lie far from you on the rock of Alamut, because those whom you have chosen for your service are at my command and obey my direction. One who could fix this poniard in your bed could also have planted it in your heart. But I saw in you a good man and have spared you. So let this be a warning to you." The sultan took fright having filled with great awe. He ordered the raising of the siege, and desisted from his inimical designs and concluded a pact of peace with Hasan bin Sabbah in 516/1123, recognizing an independent state of the Nizari Ismailis, and concluding to Hasan the right of collecting revenues of Qumis and its dependencies. It also granted to the Ismailis the right to levy toll on the caravans of traders passing beneath Girdkuh. Other terms of the treaty were that the Ismailis should not build new castles; should not any more buy armaments and should not enlist any new convert to their faith after the date of signing the treaty.