The poem is based on the Haft Paykar by Nizami, written around 1197 AD, which in turn takes its outline from the earlier epic Shahnameh written by Firdausi around 1010 AD.