Under the Saadi dynasty, the country ended the Aviz dynasty of Portugal at the Battle of Alcácer Quibir 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 Empire in 1591. However, managing the territories across the Sahara proved too difficult. After the death of al-Mansur, the country was divided among his sons.