Afrasiab (Persian: افراسياب afrāsiyāb; Avestan: Fraŋrasyan; Middle-Persian: Frāsiyāv, Frāsiyāk, and Freangrāsyāk) is the name of the mythical king and hero of Turan. He is the main antagonist of Shahnameh.
According to the Shahnameh (Book of Kings), by the Persian epic poet Ferdowsi, Afrasiab was the king and hero of Turan and an archenemy of Iran. In Iranian mythology, Afrasiab is considered by far the most prominent of all Turanian kings; he is a formidable warrior, a skilful general, and an agent of Ahriman, who is endowed with magical powers of deception to destroy Iranian civilization.
According to Islamic sources, Afrasiab was a descendant of Tūr (Avestan: Tūriya-), one of the three sons of the Iranian mythical King Fereydun (the other two sons being Salm and Iraj). In Bundahishn, he is named as the seventh grandson of Tūr. In Avestan traditions, his common epithet mairya- (deceitful, villainous) can be interpreted as meaning 'an evil man'. He lived in a subterranean fortress made of metal, called Hanakana.
According to Avestan sources, Afrasiab was killed by Haoma near the Čīčhast (possibly either referring to Lake Hamun in Sistan or some unknown lake in today's Central Asia), and according to Shahnameh he met his death in a cave known as the Hang-e Afrasiab, or the dying place of Afrasiab, on a mountaintop in Azerbaijan. The fugitive Afrasiab, having been repeatedly defeated by the armies of his adversary, the mythical King of Iran Kay Khosrow (who happened to be his own grandson, through his daughter Farangis), wandered wretchedly and fearfully around, and eventually took refuge in this cave and died.