The Caucasus mountain range in the northern border of Azerbaijan was a natural defensive obstacle form the foreign campaigns. On the territory of Azerbaijan the most acceptable way for invasions was the Caspian plain, which finished the mountain range. Through this narrow Caspian plain passed the most important trade wav. which united Azerbaijan and Middle Asia with the South-west Europe. In the northern part of Azerbaijan on the Caspian Shore territory, as the result of historical urgency there was established the complex of defensive constructions, which had military, strategical, trade and economic importance. This complex consists of 000 defensive obstacles, town stronghold palaces and towers. The geographical boundary of Caspian Shore defensive constructions occupies the territory from Derbent city to Apsheron peninsula. In order to protect such big territory, there has been built. huge constructions, extending on many kilometers, composing united defensive system.
Between Behsbarmag Mountain, located in the end of the Caucasus range,, in the southeast part, and the Caspian shore exists the narrowest passage (11.75 km). This passage was built from the raw brick and finished by two parallel walls, which were at the distance of 200 meters from each other. Taking the name from Beshbarmag Mountain, according to the writing sources, Beshbarmag barrier was built in the period of Shah Sasanid Yezdegird 2 (438-457).
In this barrier, in the mountain, separately was built a stone stronghold, and on the caravan way, at the foot of the mountain was a caravan shed.
Beshbarmag is also a place of imposing warship.
In the north from Beshbarmag, there is the Gil-gilchay barrier, which is the biggest monument among the Caspian Shore defensive constructions. The Gil-gilchay defensive barrier was built in the period of Shah Gubad, from Sasanid dynasty(488-531). The Gil-gilchay barrier, which in Arabic sources called "Sur attin" or "Gil divar", closing the Caspian Shore passage and the Gilgilchay pond, extends through all law south-east parts of Big Caucasus, and finishes in the Babadag mountain.
That part of the barrier, which closes the Caspian plain has been made from the raw bricks, but the biggest part of the Gil-gilchay barrier in the mountain was made of stone "of long walls", and that walls consisted of towers and strongholdes, which gave the firmness to the fortification works. In the strategically important places of the barrier were the special town strongholdes, and also were established many defensive stations, where the guardsmen lived. The rest of the stronghold walls and guardhouses can be seen in a big territory. The best preserved of them is Chiraggala stronghold, which is located in the Devenchy region, in the Chirag village. Being not far from the Gilgilchay barrier, Shabran town, in some sources was called as "Shabran barrier or "Shabran walls". Shabran town was founded at the same period as Gilgilchay barrier in the century and it as a very important place, where all international caravan ways joined. Shabran was the biggest province in Azerbaijan, producing raw silk, which took an active part in the international transitive trade. Apsheron peninsula, which was in Caucasus Albany, and then in Shirvanshah's State, was rich in strategically products (gas, salt, saffron), and was very often exposed to Russian, Cossacks, Turkmens, and even Italian brigand invasions. In order to interrupt those invasions, defensive constructions were built, and together with Caspian Shore barriers, they acted as united defensive system.
In XX century, Shirvanshahs began to fortify a defensive system in Baku and it's environs. In order to become the biggest and the most acceptable harbor on the Caspian seashore, Baku turned into a strong town stronghold after Derbend. A great and important role in the defensive system of Baku stronghold played Maiden tower (5-12) and Bayil (Sabayil) palace, which protected Baku from the sea. Bayil palace was built in 12-')4. This palace was supposed to be the gate for the international sea-trade and the first strong stronghold in Baku bay protecting from invasions from the sea, and also to be the residence of Shirvanshah. But as the result of strong earthquake in 1306, and the rise of water level in the Caspian Sea, this palace went down.
All big villages on Apsheron peninsula historically consisted of stronghold constructions. Some of them named as palaces still exist. The strongholdes in the defensive system of the Apsheron peninsula, which were built at the same period near to each other, occupy a very important place in Mardakan village. The oldest of them is Mardakan stronghold, which was built in 11 87-1188 in the period of Akhista II Shirvanshah shah. Gershasb in 1204 from Shirvanshahs dynasty built the other stronghold named as Small Mardakan stronghold. Near to the Mardakan stronghold on the seashore of the Shagan village can be seen the ruins of the old stronghold (XIII). The stronghold of Nardaran village was built in 1301. One of the Absheron monumental constructions is Romana palace (XIV). According to the calculations, there were more than 30 strongholdes in Absheron peninsula.
The largest number of palaces on Absheron peninsula were built in the villages, in the north seashore. This is because the main danger came from sea, and also because the stronghold towers received the dangerous signals from the northern Caspian Shore defensive barriers and could pass them to other towers on the peninsula. The dangerous signals were pass with the help of the fire at nights, and the smoke in the afternoons. So, the news about the threat spread all over the territory and population, and the army was ready to defend.