Like madaris (which referred to higher education), a maktab was often attached to an endowed mosque.