The Saadi Sultanate (also rendered in English as Sa'di, Sa'did, Sa'dian, or Saadian; ) was a state which ruled present-day Morocco and parts of West Africa in the 16th and 17th centuries. It was led by the Saadi dynasty, an Arab Moroccan Sharifian dynasty. The dynasty's rise to power started in 1510 when Muhammad al-Qa'im was declared leader of the tribes of the Sous valley in their resistance against the Portuguese who occupied Agadir and other coastal cities. Al-Qai'm's son, Ahmad al-Araj, secured control of Marrakesh by 1525 and, after a period of rivalry, his brother Muhammad al-Shaykh captured Agadir from the Portuguese and eventually captured Fez from the Wattasids, securing control over nearly all of Morocco. After Muhammad al-Shaykh's assassination by the Ottomans in 1557 his son Abdallah al-Ghalib enjoyed a relatively peaceful reign. His successors, however, fought with each other, culminating in the 1578 Battle of Ksar el-Kebir (or "Battle of the Three Kings"), where a Portuguese military intervention on behalf of Muhammad II al-Mutawakkil was thoroughly defeated by Saadian forces. In the wake of this victory, Ahmad al-Mansur became sultan and presided over the apogee of Saadian power. In the later half of his reign he launched a successful invasion of the Songhai Empire, resulting in the establishment of a Pashalik centered on Timbuktu. After Al-Mansur's death in 1603, however, his sons fought a long internecine conflict for succession which divided the country and undermined the dynasty's power and prestige. While the Saadian realm was reunified at the end of the conflict in 1627, new factions in the region rose to challenge Saadian authority. The last Saadian sultan, Ahmad al-Abbas, was assassinated in 1659, bringing the dynasty to an end. Moulay al-Rashid later conquered Marrakesh in 1668 and led the Alaouite dynasty to power over Morocco. The Saadians were an important chapter in the history of Morocco. They were the first Arab Sharifian dynasty to rule Morocco since the Idrisids, establishing a model of political-religious legitimacy which continued under the later Alaouites, another Sharifian dynasty. They successfully resisted Ottoman expansion, making Morocco the only part of North Africa to remain outside Ottoman suzerainty, but followed Ottoman example by modernizing their army and adopting gunpowder weapons. During the long reign of Ahmad al-Mansur in the late 16th century, Morocco established itself as an ambitious regional power that expanded into West Africa and pursued relations with Europe, including a