Idris bin Abdullah bin al-Hasan al-Muthanna bin al-Hasan bin Ali bin Abi Talib escaped from the massacre of Fakh and reached Al-Maghrib, the details of which are given in his life-account. He stayed in the town of Walaila with its chief Ishaq bin Muhammad bin Abdul Hamid al-Urbi. This happened on the first of Rabi-ul-Awwal 172 A.H. It was the beginning of the Idrisid Shi'ite State of Maghrib.
During the reign of aforementioned Idris I, a huge army was organized for the state which conquered all the surrounding areas up to the extreme parts of Al-Maghrib, especially those where Islam had not yet reached like Kablad (Tadla), the forts of Fandlawah, Madyutah, Bahlulah, Ghiyathah, Fazar etc. He further advanced and conquered the areas which are known as Al-Maghrib Al-Awsat.
In this way he was able to establish his rule and maintain it and set the rules of government. But he was suddenly poisoned to death and was succeeded by his son Idris bin Idris. What he did and achieved is given in detail in his life-account. In brief, this state continued to be stronger day by day. Idris II became the accepted ruler of Al-Maghrib. His power increased and his armies as well as followers became more and more. His reign is distinguished by the fact that he did not concentrate on Berbers alone, but Arabs from Africa (modern Egypt and Eastern Libya) came to him to join him, e.g. people from Banu Qais, Banu Azd, Banu Mudhhiji, Banu Yahsab, Banu Sadaf etc. They became his ministers and judges. Now the capital of the state Walaili became too small to fulfill the needs of a developing state. Idris II therefore built a new capital and named it Fas. Then he expanded his territory and conquered the cities of Nafis and Aghmat as well as surrounding areas. The Khariji propaganda was very much prevalent among the Berbers at that time. He dealt with them and subdued them. Then he took away Algiers and Morocco from the Abbasid, extending from Sus to the Valley of Shalaf.
He died after a rule of 36 years. His kingdom settled and his leadership firmly established.
He was succeeded by his son Muhammad bin Idris who had eleven brothers. He therefore distributed the whole territory among his brothers and made his viceroys in those regions. He himself remained in Fas. The author of Al-Istiqsa' says, "They controlled the officials, guarded the borders, protected its roads and they were envied for their character.
But the distribution of the territory among the brothers did not prove fruitful. Muhammad bin Idris took that step to give an equal share to his brothers and let them participate in the rule which might improve on account of competition. But the result was quite different from what he had desired. There arose troubles among them which led to mutual fighting sometimes. On the death of Muhammad bin Idris, his son Ali bin Muhammad known as Haydarah came to throne.
According to the author of Al-Istiqsa', his age was the best. Ibn Abi Zara' says about him that he acted upon the ways of his father and grandfather in adhering to justice and therefore, the people lived in his age in peace and order.
He was succeeded by his brother Yahya bin Muhammad about whom Ibn Khaldun says, "His authority extended, his state became grand, his reign became good. The city of Fas developed. Many public baths and hotels ware erected to which people from far off borders came to live. Similarly Ibn Abi Zara says "People from Andulus(Iberian Peninsula), Africa and different parts of Al-Maghrib came to this city.". During his reign the Mosque of Al-Qarwiyyin was built in the city of Fas.
He was succeeded by his son Yahya. Ali bin Uman bin Idris, Yahya bin al-Qasim bin Idris, Yahya bin Idris bin Uman bin Idris, one after another. The author of Al-Istiqsa says about him that he was the joining link between the members of Idris family. He had the most prominent position among them and had the most fame. He was also more just than all of them, more qualified and had wider authority. He was a jurist and had memorized a large number of Traditions. He was an eloquent, conversationalist, brave, patient, considerate and very religious and pious. Ibn Khaldun remarks that none among the Idrisids reached his glory in respect of territory as well as authority.
The Idrisid state was merged into the Fatimids when their first Caliph Ubaidullah al-Mahdi appeared. His commander advanced towards Fas in 503 A.H. and laid siege to it till the Idrisid king Yahya agreed to take the oath of fealty to the Fatimid Caliph.

Idrisids in Al-Maghrib
Cidiuea has said in his book on the History of Arabs, "The Idrisid remained in possession of the territory they had captured from 803 to 949 A.D. They stayed in a country which is greatly indebted to them.
They founded the city of Fas, the Mosque which became the most sacred monument for all the people living in the surrounding areas. It became well known within a very short span of time. The city contained a large number of schools and libraries which carried on the work by the Abbasids in the form of literary and intellectual movement in the East. This city therefore became a huge store-house (of knowledge) between the Arabs of Spain and those of Africa".
The fact is that the establishment of the ldrisid state in Al-Maghrib led to grand consequences due to their efforts. Islam spread to every part of Al-Maghrib. Through their efforts, literary and intellectual movements started there and schools and libraries were set up. Urbanization increased and cities were founded which led to development of civilization and growth of culture.
Had not there been those difficult conditions which they had to face and which limited their activities and paralyzed their efforts, they had been much more than what they appear to us now.
The most glorious work which the Idrisids did was Islam was spread among the Berbers through their efforts and was firmly rooted among them, so much so that they became the staunchest among the tribes of Al-Maghrib in respect to defending Islam. Most of them were non-Muslims. The reason was that the Muslim conquerors before Idrisids gave them a bad treatment. When Idris I reached there, stayed among them, married a Berber woman who gave birth to many children, the Berbers and their grand-children became amalgamated. This fact the unification of the Berbers and grand-children of Idris I is borne out by more than one historian. They thus become one with the Berbers and propagated for Islam in those areas, and consequently founded two famous Islamic states in Al-Maghrib.
One of the most important factor which helped the Idrisids succeed in their mission and convert the Berbers to Islam was the treatment meted out to them by the Umayyad and Abbasid rulers which was nothing but dire cruelty and injustice that negated the spirit of Islam and presented it in most dark colors. This was the reason why the whole territory of Al-Maghrib always remained in continuous rebellion which could never be settled. The freedom-lovers of that area were always in search of a person who could be one with them. Most of them supported the Khariji and joined them in revolts against the government.
The Umayyad as well as the Abbasid ruled over these areas very cruelly and treated the people including the Berbers very badly, which made them run away from Islam and time and again rise in revolt against the rulers. This is just the opposite of what some historian write. As evidence we would like to refer to one incident which could hold us out. Yazid bin Abi Muslim Dinar was a freed slave of Hajaj Thaqafi who had made him his secretary and in-charge of the police. During the reign of Yazid bin Abdul Malik, he was appointed as viceroy in Al-Maghrib. He followed the policy of Hajaj in that area. One of the actions of Hajaj was that he used to levy Jizya on those who had become Muslims and ordered to go back to their villages in the same condition as they had been before their conversion to Islam.
Yazid bin Muslim tried to do exactly like Hajaj and impose his policy on Berbers. But Berbers did not remain patient over it and made a plan to kill him in which they succeeded. Similarly during the reign of Hisham bin Abdul Malik, the governor of Tanjah was Umar bin Abdullah al-Muradi. They ruled the Berbers very badly and tried to levy taxes from them which was usually taken from non-Muslims. Thus, the Berbers started hating and their hearts turned away from Muslims and they thought they were being exploited by the Arabs.
All the governors appointed by the Umayyads and the Abbasids on the whole annoyed the Berbers on account of the unjust demands they made to the Berbers. One example of such demands is that these officials liked the honey-coloured skins and took to extreme in acquiring and collecting them. Sometime a complete herd of sheep was slaughtered just in order to get the skins of their lambs still in the wombs, although they could get only one skin in such an operation. The author of Al-Istiqsa' says, "They appropriated the property of the together and defy such actions."
The honey-colored skins are just one example of the way the rulers played with the people in Al-Maghrib and made strange on them.
When Idris I reached and established the Idrisid state in Al-Maghrib, the Berbers came to know for the first time what real Islam is, and not what was represented by those tyrants. They realized that Islam was all justice, tolerance and mercy. They therefore joined its ranks in increasing numbers through the efforts of the Idrisids who were the descendents of Holy Prophet Muhammad (S.A.W.) and Imam Ali (A.S.).
These Berbers tribes succeeded the Idrisids in Morocco and what was left to the Muslims from Spain and established states other than those of the Berbres, like the Mu'ahhidin, Bani Marin, and Al-Murabitah. Some of these Berber States are famous for their stand in defense of Islam in Spain and against the European tyrants.
These Berbers have inherited their love and devotion for Holy Ahl al-Bait (A.S.) which is manifested even in our own time. Many a family of the Sayyids are still living in Al-Maghrib and enjoy great respect of the people in general.

Idrisids Love for knowledge
There would hardly be a scholar or student working in the filed of geography who does not know Sharif al-Idrisi who is the author of Nazhat-ul-Mushtaque Fi Ikhtiraq-il-Afaq, which is considered to be the best work on geography written by Muslims. Al-Idrisi also made a famous map which has been published in Arabic as well as Latin.
He is also known as Sharif Sagilli and he lived in Sigliyyah (Sicily) . He is also called Qurtabi because of the fact that he had studied in Qurtabah (Cordova) and attached himself to Roger the Great who was the ruler of Cordova and established a vast kingdom on Sicily which included many islands near it, after when the Fatimids and Banu Aghlab had lost their power. This king took care of good qualities of the Muslims and their scholars in order to benefit from their knowledge. One example is Sharif Idrisi.
The Idrisids, called by the name of the Family of As-Saqalli, specialized in medicine. They lived in what is now known as Tunis. They passed on this knowledge on their generations. Most of them are the descendants of Sharif al-Idrisi. This family of the Idrisid originally belonged to Sabtah, from where they migrated to Morocco. Some of them migrated to Sicily and others to Tunis and other parts of the territory which was then known as Al-Maghrib.
A part from the book already mentioned, Al-Idrisi wrote another scientific book relating to botany and named it Jame' Ashtat-un-Nabat. In this book he has collected the names of different plants in various languages, the number of which is more than ten languages, both Eastern and Western. From this book, we can conclude that Al-Idrisi was well-versed in botany, natural sciences and medicine more than his knowledge of geography, This book indicates the depth of his knowledge and keenness of his research. It is counted among rare manuscripts.
Besides Ash-Sharif was a traveler too who has traveled for and wide in the East as well as in the West, as is evidenced by his writing. He was also a poet of great prominence.

Idrisids History yet to be written
Dr. Husain Munis says, "The Idrisid State still needs a person who should write their history and defines its role in the development of Al-Maghrib. Till now, the authors of Islamic History count this state among small kingdoms which rose up at the disintegration of Al-Maghrib in the mid-second century after Hijrah. They treat it as they do the kingdoms of Banu Aghlab or Banu Rustum, and even at par with that Banu Madrar. During this modest exposition, they fail to discuss as how this state reserved a place for Islam and Arabism in Al-Maghrib and to show the great role it played in extending Islam's message to Morocco and Algiers, as well as how they put an end to foreign intrusions which were crushing this area during the last decade of the first century of Hijrah. They do not show what efforts its rulers made in laying the foundations of Islam in this area in the real sense of the word and stamping it permanently with Arabic color, giving this area the Arabic language and culture. Due to the good offices of the Idrisides, this country became an invincible fortress of Islam in the Western wing."