After the Saadi, the Arab Alaouite Dynasty eventually gained control. Morocco was facing aggression from Spain and the Ottoman Empire that was sweeping westward. The Alaouites succeeded in stabilizing their position, and while the kingdom was smaller than previous ones in the region, it remained quite wealthy.