The Iranian national epic achieved its accomplished form in Persian in the Book of Kings (the Shah-nama) by the poet Ferdowsi (c. 934–1020 A.D.), but its origins can be traced as far as the Avesta, the sacred book of the Zoroastrians, composed between the seventh and fourth centuries B.C. According to the various versions of the legend, Afrasiab, king of the Turanians (enemies of the Iranians), exerted a tyrannical rule over Iran until he was defeated and slain by his own grandson Kay Khosrow, legitimate heir of the Iranian kings through his father Siyavush. In the Bundahishn, a Zoroastrian treatise, Afrasiab dwells in a subterranean palace provided with an artificial sun and moon. Local storytellers fancied the high cliffs edging the loess plateau of the first city of Samarkand were concealing Afrasiab’s palace.