Because it bordered the desert, Gaza was vulnerable to warring nomadic groups. In 796 it was destroyed during a civil war between the Arab tribes of the area. However, by the 10th century, the city had been rebuilt by the Abbasids; during Abbasid rule, the Jerusalemite geographer al-Muqaddasi described Gaza as "a large town lying on the highroad to Egypt on the border of the desert." In 978, the Fatimids established an agreement with Alptakin, the Turk ruler of Damascus, whereby the Fatimids would control Gaza and the land south of it, including Egypt, while Alptakin controlled the region north of the city.