In 1537, the Ottoman Empire governor of Bosnia, Gazi Husrev-beg, established a madrasa for the education of the people of the region.
The library and the madrasas functioned for over three hundred years as one unit until, in 1863, the library was moved to its own room, where it stayed until 1935 when it was moved to the Sarajevo Mufti's office outside the Careva Mosque.