Dhul-Qarnayn, (Arabic: ذو القرنين ḏū al-qarnayn, IPA: [ðuːlqarˈnajn]), or Zulqarnayn, "he of the two horns", appears in Surah 18 verses 83-101 of the Qur'an as a figure empowered by Allah to erect a wall between mankind and Gog and Magog, the representation of chaos. In the Islamic apocalyptic tradition the end of the world would be preceded by the release of Gog and Magog from behind the wall, and their destruction by God in a single night would usher in the Day of Resurrection. In traditional scholarship the character is usually identified as Alexander the Great, who is ascribed similar adventures in the Alexander romance.
The story of Dhul-Qarnayn is related in chapter 18 (Surat al-Kahf, "The Cave") of the Quran. This chapter was revealed to Muhammad when his tribe, Quraysh, sent two men to discover whether the Jews, with their superior knowledge of the scriptures, could advise them on whether Muhammad was a true prophet of God. The rabbis told them to ask Muhammad about three things, one of them "about a man who travelled and reached the east and the west of the earth, what was his story". "If he tells you about these things, then he is a prophet, so follow him, but if he does not tell you, then he is a man who is making things up, so deal with him as you see fit." (Verses ).
Muslim and other commentators have identified Dhul Qarnayn with Alexander the Great. According to a legend current in Jewish circles around the time of Christ the Scythians, identified with Gog and Magog, once defeated one of Alexander's generals, upon which Alexander built a wall in the Caucasus mountains to keep them out of civilised lands; the legend went through much further elaboration in the following centuries, and eventually found its way into the Quran through a Syrian version.