The Gates of Alexander was a legendary barrier supposedly built by Alexander the Great in the Caucasus to keep the uncivilized barbarians of the north (typically associated with Gog and Magog) from invading the land to the south. The gates were a popular subject in medieval travel literature, starting with the Alexander Romance in a version from perhaps the 6th century.
The wall, also known as the Caspian Gates, has been identified with two locations: the Pass of Derbent, Russia or with the Pass of Dariel, west of the Caspian Sea. Tradition also connects it to the Great Wall of Gorgan (Red Snake) on its south-eastern shore.
In reality, these fortifications were built by Persian monarchs. Derbent (Persian: دربند Darband, "closed gates"), was established in the end of the 5th or the beginning of the 6th century, when the city was refounded by Kavadh I of the Sassanid dynasty of Persia; The Great Wall of Gorgan during the Parthian dynasty.
The name Caspian Gates originally applied to the narrow region at the southeast corner of the Caspian Sea, through which Alexander actually marched in the pursuit of Bessus, although he did not stop to fortify it. It was transferred to the passes through the Caucasus, on the other side of the Caspian, by the more fanciful historians of Alexander.
Josephus, a Jewish historian in the 1st century, is known to have written of Alexander's gates, designed to be a barrier against the Scythians. According to this historian, the people whom the Greeks called Scythians were known (among the Jews) as Magogites, descendants of Magog in the Hebrew Bible. These references occur in two different works. The Jewish War states that the iron gates Alexander erected were controlled by the king of Hyrcania (on the south edge of the Caspian), and allowing passage of the gates to the Alans (whom Josephus considered a Scythic tribe) resulted in the sack of Media. Josephus's Antiquities of the Jews contains two relevant passages, one giving the ancestry of Scythians as descendants of Magog son of Japheth, and another that refers to the Caspian Gates being breached by Scythians allied to Tiberius during the Armenian War.
The Gates occur in later versions of the Alexander Romance of Pseudo-Callisthenes, in the interpolated chapter on the "Unclean Nations" (8th century). This version locates the gates between two mountains called the "Breasts of the North" (Greek: Μαζοί Βορρά). The mountains are initially 18 feet apart and the pass is rather wide, but Alexander's prayers to God causes the mountains to draw nearer, thus narrowing the pass. There he builds the Caspian Gates out of bronze, coating it with fast-sticking oil. The gates enclosed twenty-two nations and their monarchs, including Goth and Magoth (Gog and Magog). The geographic location of these mountains is rather vague, described as a 50-day march away northwards after Alexander put to flight his Belsyrian enemies (the Bebrykes, of Bithynia in modern-day North Turkey).
A somewhat similar story also appears in the Qur'an, Surat al-Kahf 83-98 with key differences. Rather than the builder being a conquering emperor like Alexander, the Qur'an describes a liberating hero predating Alexander, known as Dhul Qarnayn. Also the structure is a huge iron wall rather than a gate and its purpose is to defend people at the foot of two mountains from Gog and Magog.
During the Middle Ages, the Gates of Alexander story was included in travel literature such as the Travels of Marco Polo and the Travels of Sir John Mandeville. The identities of the nations trapped behind the wall are not always consistent, however; Mandeville claims Gog and Magog are really the Ten Lost Tribes of Israel, who will emerge from their prison during the End Times and unite with their fellow Jews to attack the Christians. Polo speaks of Alexander's Iron Gates, but says the Comanians are the ones trapped behind it. He does mention Gog and Magog, however, locating them north of Cathay. Some scholars have taken this as an oblique and confused reference to the Great Wall of China, which he does not mention otherwise. The Gates of Alexander may represent an attempt by Westerners to explain stories from China of a great king building a great wall. Knowledge of Chinese innovations such as the compass and south-pointing chariot is known to have been diffused (and confused) across Eurasian trade routes.
The medieval German legend of the Red Jews was partially based on stories of the Gates of Alexander. The legend disappeared before the 17th century.
It is not clear which precise location Josephus meant when he described the Caspian gates. It may have been the Gates of Derbent (lying due east, nearer to Persia), or it may have been the Darial Gorge, (lying west, bordering Iberia or Georgia proper. Both are situated in present-day Dagistan.
However, neither these were within Hyrcania, but lay to the north and west of its boundaries. Another suggestion is some mountain pass in the Taurus-Zagros Mountains, somewhere near Rhaegae, Iran, in the heart of Hyrcania.
The Gates of Alexander are most commonly identified with the Caspian Gates of Derbent, whose thirty north-looking towers used to stretch for forty kilometers between the Caspian Sea and the Caucasus Mountains, effectively blocking the passage across the Caucasus.
Derbent was built around the world's only surviving Sassanid Persian fortress, which served as a strategic location protecting the empire from attacks by the Gokturks. The historical Caspian Gates were not built until probably the reign of Khosrau I in the 6th century, long after Alexander's time, but they came to be credited to him in the passing centuries. The immense wall had a height of up to twenty meters and a thickness of about 10 feet (3 m) when it was in use.
The Pass of Dariel or Darial has also been known as the "Gates of Alexander" and is a strong candidate for the identity of the Caspian Gates.
An alternative theory links the Caspian Gates to the so-called "Alexander's Wall" (the Great Wall of Gorgan) on the south-eastern shore of the Caspian Sea, 180 km of which is still preserved today, albeit in a very poor state of repair.
The Great Wall of Gorgan was built during the Parthian dynasty simultaneously with the construction of the Great Wall of China and it was restored during the Sassanid era (3rd-7th centuries)