Nizami originally lived in Nishapur, in the Khorasan region of present-day Iran. When the region became unsafe because of the Khwarazmian-Ghurid conflict, Nizami visited the Imam Reza shrine and sought advice from his religious preceptor Muhammad Kufi.