An institute providing middle and upper level education, where mainly theology and church law was taught. Early, 10th-century medreses were small, they were formed around one teacher. In the 11-12th centuries they became state institutes with teaching staff and students financed from revenues of foundations. In the Seljuk age they also functioned as hospitals in the territory of Anatolia. In the occupied region there were different medreses in Hungary. The best known one was in the Buda castle, the medrese founded by Pasha Mustapha Sokullu (1566-1578), connected to the Big Jami (Church or Our Lady, today: Matthias church).