The conflation of Gog and Magog with the legend of Alexander and the Iron Gates was disseminated throughout the Near East in the early centuries of the Christian era. In Islam Alexander is known as Dhul-Qarnayn, "the two-horned one"– the name is taken from the Syrian legend and describes his journeys from one extremity ("horn") of the world to the other. Dhul-Qarnayn (Alexander), having journeyed to the ends of the world, meets "a people who scarcely understood a word" who seek his help in building a barrier that will separate them from the people of Yajuj and Majuj (Gog and Magog) who "do great mischief on earth" and live across the mountain. He agrees to build it for them, but warns that when the time comes (Last Age), Allah will remove the barrier and Yajuj and Majuj will swarm through.
circa 1110 CE
This is a map drawn by al-Idrisi in the twelfth century, which mentiones God and Magog in the South-East corner of the map, enclosed within dark mountains in the bottom-left edge of the Eurasian landmass.