The Ṣanhāja were a large group, the sedentary part of them is later known to live in the area of today's north-eastern Algeria. From among them came the Zirid dynasty, which ruled as governors of Ifrikiya for Fatimid caliphs, after the Fatimids moved their capital to Egypt. Another well-known dynasty of this branch of the Sanhaja were the Hammadids, who established their power as Zirid emirs, first in 987 in Ashir, and from 1007/1008 around Qalaat Beni Hammad.