Ksar is the North African Meghrebi Arabic term for "castle", possibly loaned from Latin castrum. The term generally means a fortified village.
Ksour in the Maghreb typically consist of attached houses, often having collective ghorfa (granaries) and other structures like a mosque, bath, oven, and shops. Ksars are sometimes situated in mountain locations to make defense easier; they often are entirely within a single, continuous wall. The building material of the entire structure is normally adobe, or cut stone and adobe. Ksars form one of the main manifestations of Berber architecture.
From Wikipedia