The page does not show that this wall was built for defence.
Debated. A big wall stood on a ridge, but no one can say for sure why.
At Oued Beht, in north-west Morocco, people built a ditch, a bank and a wall about 4,000 to 3,500 years ago. The wall ran across a narrow part of the ridge, between a river and a steep drop. It cut off the southern tip of the ridge. Before that, about 5,400 to 4,900 years ago, people here grew barley and wheat, kept animals, and made polished stone axes and painted pots.
The page says no one knows what danger the wall was meant to meet.
https://www.ancient-origins.net/news-history-archaeology/oldest-defense-system-africa-00103180