Kaitag and Kumukh, but decided not to move into Avaria. History shows that no Arab or Seljuk conquest of mountainous Dagestan took place during the 9th to 12th centuries. In this period there was a long feud that spanned southern Dagestan, Derbent and Shirvan. At the beginning of the 12th century Seljuks were not able to hold on to Shirvan. In 1123 a joint army of Georgians and Shirvanians defeated the Seljuks in the battle of Shamakha. In 1173 Shirvanshah Akhsitan I ibn Minuchihr III in union with Georgia and Byzantium waged a war on Dagestanis, Kipchaks and Russians. There are no reports from sources that the rulers of Kumukh embraced Islam before the invasion of the Mongol-Tatars in the 13th century. The names of Kumukh rulers appear only after the Mongol invasion. Islamic "Gazi-Kumukh" was first mentioned in the 14th century. Researchers thought of the Derbent-nameh chronicle as doubtful written by the people of shamkhal in the 17th century. This chronicle is not contrary to the history and describes the Arab invasion of Dagestan. There are some facts confirming this chronicle such as the mosque built at the end of the 8th century in Kumukh and the fame of Kumukh as the old residence of the influential shamkhal. The dynasty of rulers of Kumukh with the title shamkhal must have existed in the 8th century as the rulers of shamkhalate believed. Mongolo-Tatar invasions in the 13th to 14th centuries Capture of Kumukh In 1239 Mongolo-Tatars advanced to capture Kumukh, the highland capital of Laks. The siege of Kumukh fortress using machines and catapults lasted about six months. In 1240 on April 8, Kumukh was captured and destroyed. Ismey-Haji Guseinov wrote: "In spring of 1240 Bugdei, one of warlords of Batu Khan, approaches Kumukh and after a fierce resistance of defenders of the fortress takes the capital of shamkhalate. However, Mongols had not managed then to establish themselves in Lakia as well as in other regions in the mountains of Dagestan". Alliances In the middle of the 13th century the rulers of Kumukh converted to Islam and shamkhalate became an influential Islamic state. In 1302 the ruler of Iran, who sent gifts to Badr-shamkhal of Kumukh was none other than the descendant of Genghis Khan, Ghazan Khan (1295–1304). According to Lavrov, Badr-shamkhal carried out a gazi-raid on Zirikh-Geran and built a mosque there. Records of Ali Kayaev showed that by