Ksour Essef or Ksour Essaf (قصور الساف) is a town and commune in the Mahdia Governorate, Tunisia, on the coast of the Sahel, about 200 km south of Tunis. As of 2004 it had a population of 26,219.
Ksour Essef is noted as the birthplace of the poet Youssef Rzouga.
According to oral tradition, the site was occupied by a system of ruined Roman fortifications, which served as a refuge for sparrowhawks (sâf), whence it got the name "Sparrowhawk Castle". This legend contains a note of truth because a text attests that the aristocracy of Mahdia, located twelve kilometres from Ksour Essef, was accustomed to hunt sparrowhawks in the region of Salakta and its environs.
Ksour Essef is divided into many suburbs, including El Baabouss, El Tafalla, Bab El Ksar and Mallaji city. There are several beaches near the village of Salakta.
The creation of the city coincided with the arrival of Banu Hilal in 1050. After the destruction of the city of Salakta and the arrival of the Arabs, most of the punic, Greek and Roman inhabitants converted to Islam.