Former capital of Morocco 808-1062, 1296-1548, and 1662-1912, in a valley N of the Great Atlas mountains, 160 km/100 mi E of Rabat; population (1982) 563,000. Textiles, carpets, and leather are manufactured, and the fez, a brimless hat worn in S and E Mediterranean countries, is traditionally said to have originated here. Kairwan Islamic University dates from 859; the second university was founded 1961.