Most of the buildings in the dargah complex (including Panchakki) were erected by Turktaz Khan, a noble on the staff of Nizam-ul-Mulk Asaf Jah in about 1695 A. D. The oblong reservoir in front of the mosque and fountains were added 20 years later by Jamil Beg Khan. Dating back to the 17th century, this ingenious water mill was designed to use the energy generated by flowing water from a nearby spring to turn the large grinding stones of the flour mill. Shah Mosafar died in Hijri 1110. This watermill was used to grind grain for the pilgrims and disciples of saints as well as for the troops of the garrison. The building, attached to the dargah of Baba Shah Musafir a Sufi saint is located in a garden near the Mahmud Darvaza and consist of a mosque, a madrassa, a kacheri, a minister's house, a sarai and houses for zananas