Abu Abdallah al-Qaim bi Amrillah of Tagmadert in the Draa River valley, a claimed descendant of Fatimah, was the ancestor of the Saadi Dynasty of Morocco, who ruled the Sous in Southern Morocco from 1509 to 1517. The Sharifian movement on which the Saadi Dynasty was to be built began when Abu Abdallah, during a visit to Medina, dreamed of two lions entering a tower with a crowd of people close behind. Taking his vision to a Sufi sheikh, he was told that his two sons would have an important future in his country. Upon returning to Morocco he began to broadcast the vision among his people, who believed him, according to Moroccan historian al-Nasiri, because of his reputation for honesty, and he adopted the Mahdist title "al-Qaim bi Amrillah" (the one called by God).
After meeting with the leaders of the Masmuda Berbers at Tidsi near the town of Taroudannt, Abu Abdallah al-Qaim agreed to lead the jihad against the Portuguese at Agadir and other towns along the southern coast. He then sent his two sons Ahmad al-Araj and Mohammed Amghar (later called Mohammed ash-Sheikh) to Fez, where they established themselves as teachers of religion and literature and exhorted the sultan to raise a full jihad in the south. The Wattasid sultan Abu Abdallah al Burtugali gave them full permission to carry out their jihad in the Sous. This enabled the Saadians to transform their moral authority into a military authority. After they had forced the Portuguese out of their coastal positions, they took the power in Marrakech.