Firstly settled by Caucasian Albaniaball, it passed through the rule of Parthiaball and Sassanidball. Then, it got conquered by Byzantineball. It became an Islamic city under Rashidunball and got conquered by Mongol Empireball and Shirvanshahball, this latter being annexed by Safavid dynastyball and in this way by the various Persian dynasties.
In 1747, after the wars between the Russians and the Persians, the city became an own Khanate, Derbent Khanateball, as a buffer state. The state lasted till 1806 when the Russians annexed it. From there on, Soviet Unionball and eventually Russiaball controlled the city.