The oldest period in the history of Dagestan is associated with the present-day mountainous Dagestan. Historically, Dagestan was a federation of mountainous principalities. Located at the crossroads of world civilizations of north and south, Dagestan was the scene of clashes of interests of many states and until the early 19th century most notably that of between Persia and Imperial Russia.
In the 6th century the Sassanid Empire after more than 100 years of war conquered the Eastern Caucasus, resulting in the entire region of Dagestan falling under the influence of Persia.
In 552, "Khazars" invaded North-Eastern Caucasus and occupied northern lowlands of Dagestan. Reigning Shah of Persia Khosrau I (531—579), to protect his possessions from the new wave of nomads, began the construction of defensive fortifications in Derbent, that closed a narrow passage between the Caspian Sea and Caucasian mountains.Khosrau I owned fortress Gumik. The modern name "Derbent" is a Persian word (دربند Darband) meaning "gateway", which came into use in this same era, in the end of the 5th or the beginning of the 6th century CE, when the city was re-established by Kavadh I of the Sassanid dynasty of Persia.
This period is known by a 150 years of war that peoples of north-eastern Caucasus fought between Arabs and Khazars. In 643, during the reign of caliph Umar ibn Khattab, Arab armies led by Abd al-Rahman ibn Rabi captured Derbent and the neighboring territories. In 652 Abd al-Rahman ibn Rabi was killed during the siege of Khazar city of Balanjar. In 662 the Khazars invaded Dagestan. In 698 Muhammad ibn Marwan, brother of caliph Abd al-Malik ibn Marwan, captured Derbent. In 705 Maslamah ibn Abd al-Malik, brother of caliph Al-Walid I, once again took over Derbent.
In 722, caliph Yazid II sent warlord al-Djarrah al-Hakami to defend the fortress of Derbent. Historian Al-Tabari writes about the campaigns of al-Djarrah: "Arabs defeating Khazars in southern Dagestan moved to the mountains of Dagestan, overcame the resistance of the people of Khamzin and Gumik and in punitive expeditions plunged and ransacked Kaitag and Tabasaran, for refusal to subordinate to their authority". Historian Balami writes that in 723 the warlord al-Djarrah "called one of his close commanders, gave him three thousand warriors and said to him: go to Kaitag, destroy there everything that you will meet on your way, fight everyone who will show you resistance and come back to me before the sunrise". In 723, Arab forces under the command of al-Djarrah move through the territory of Dagestan and capture Balanjar. In 730 al-Djarrah was killed in the battle of Marj Ardabil.
In 730-731, mentioned Maslamah ibn Abd al-Malik, brother of caliph Hisham ibn Abd al-Malik as well, "fortified Derbent in the best possible way" by building seven iron gates "and marched with his army to Kumukh". In 732 Marwan Ibn Muhammad, cousin of caliph Hisham, overcoming powerful fortresses obliges the rulers of mountainous Dagestan to pay tribute. Ibn Hayyat, Iranian author of the 9th century, informs that after the capture of "Gumik" and "Khunzakh", Marwan "went away from there, and entered the land of Tumen". According to Al-Balazuri, Marwan at the head of 120,000 army invaded Khazar possessions. The Khazar army endures a series of defeats. Marwan captures the city of Samandar. In 797 Khazars carried out an invasion of Dagestan.
^Al-Tabari (d. in 923) informs about the participation of three Sassanid rulers – Peroz I (457-484), Kavadh I (488-531) and Khosrau I (531-579) in the construction of fortifications in Derbent. (М. Т. Гаджимурадов, Л. П. Магомедов. История Дагестана. М. 2007. С. 47.)
^Ибн Рустэ. Из книги драгоценных камней. (Пер. Караулова Н. А.) — Тифлис. 1903; Баладзори. Книга завоеваний стран. — Баку. 1927. С. 7.
^Ат-Табари. Тарих ар-русуль ва-л-мулук. Сер. 1. С. 2667
^In these events, Salman ibn Rabi, brother of Abd al-Rahman, is mentioned sometimes; Ат-Табари. Указ. соч. Сер. 1. С. 2890; Ибн ал-Асир. Ал-камиль фи-т-тарих. Каир, 1934. Т. 3. С. 66.
^Мовсес Каланкатваци. История страны алуанк. Ереван, 1984. С. 160.
^In 705 caliph Al-Walid I sent his brother Maslama Ibn Abd al-Malik to capture Derbent. In 725, caliph Hisham removed al-Djarrah al-Hakami and appointed the ruler of greater part of Caucasus his brother Maslama Ibn Abd al-Malik. In 729 caliph appointed al-Djarrah a second time and removed Maslama Ibn Abd al-Malik. In 730, caliph appointed Maslama Ibn Abd al-Malik as a ruler again. In 732, caliph appointed Marwan Ibn Muhammad the ruler of Caucasian territories. Marwan Ibn Muhammad (744—750) was the last caliph of Umayyad dynasty. (Балазури, с. 19—20; ал-Якуби, с. 8—9; ал-Куфи, VIII, с. 80—82, 141 — 142, 210; Ибн ал-Асир, V, с. 70, 90, 95.).
^Г. Р. Оразаев. Дербент-наме. Дагестанские исторические сочинения. М. Наука. 1993.
^Тарихи Дербенд-наме. Историч. хроника / Под ред. М. Алиханова-Аварского, вступ. ст. и комментарии А.Р. Шихсаидова. — Махачкала, ИД «Эпоха», 2007.
^Бейлис В. М. Сообщения Халифы ибн Хаййата ал-'усфури об арабо-хазарских войнах в VII - первой половине VIII в. // Древнейшие государства Восточной Европы. 1998. М.,2000. С.43.
^Ал-Белазури. Китаб футух ал-булдан. Лейден, 1866. С. 207; Ал-Куфи. Книга завоеваний. Баку, 1981. С. 49.