 He then became a teacher there.He later became the principal of the madarsa.Niyaz got his Sufi training from Sayed Fakhar-uddin Muhammad Dehalvi, also known as Fakhr-e-Jahan, in Bareilly, (Uttar Pradesh, India).