Under the Saadi Dynasty, the country repulsed Ottomanincursions and a Portuguese invasion at the battle of Ksar el Kebir in 1578. The reign of Ahmad al-Mansur brought new wealth and prestige to the Sultanate, and a large expedition to West Africa inflicted a crushing defeat on the Songhay Empirein 1591. However, managing the territories across the Sahara proved too difficult. After the death of al-Mansur, the country was divided among his sons.