Work on the poem began around the same time as his "Moṣībat-nāma", all while Attar worked in a popular pharmacy in Nishapur, Greater Khorasan, during the age of the Seljuk Empire. During his time as an apothecary and physician, Attar remained busy with and affected by the ailments of his customers and his "Ilāhī-Nama" reflects what he learned during his time at the pharmacy. Attar spent his later years in Nishapur, where he remained comfortably retired until he was violently executed as part of a massacre during the Mongol invasion of 1221.