Madrasas also played a supporting role to major learning institutions like the Qarawiyyin Mosque; in part because, unlike the mosque, they provided accommodations for students who came from outside the city. Many of these students were poor, seeking sufficient education to gain a higher position in their home towns, and the madrasas provided them with basic necessities such as lodging and bread. However, the madrasas were also teaching institutions in their own right and offered their own courses, with some Islamic scholars making their reputation by teaching at certain madrasas.