The coming of the Arabs under 'Oqba ('Okba) in 682 was a turning point in this history, though it was not till 20 years later that his successor, Milsa ibn Nosair, undertook a successful ex pedition as far as Tafilalt and the Drata. The force of 10,000 Arabs and Egyptians with whom Tariq (Tarik) ibn Zaid held the Tangier district in 710 was trebled by the enrolment of the Berbers, who enabled him next year to invade Spain. But in 739 the Moroccan Berbers successfully revolted, setting up their first independent ruler, Maisara. Their kinsmen in Spain followed suit with equal success, and though subdued for a time, they retained their in dependence in certain parts till the 11th century, when, as mas ters of Granada, they subjugated their implacable foes, the Arabs; and finally, under the Murabti and Muwahtiadi dynasties, con quered all Mohammedan Spain.
The recorded history of the Moorish empire commences with the settlement near the Roman ruins of Volubilis in A.D. 788 of Idris the elder (Idris b. Abdallah), one of the fugitive descendants of Mohammed during the struggles between rival claimants of the caliphate. Islam had then been established in these parts for 8o years, and Idris and his son, Idris II., the builder of Fez, united the Berbers into a kingdom. Their line controlled a limited portion of northern Morocco for nearly two centuries, in part supplanted by the Miknasa in 922, until displaced by the Maghrawa in 988. These two dynasties were exterminated in 1061 by Yusef I. (bin Tashfin), founder of the Murabti dynasty of Berbers (Almora vides), who annexed the remainder of Morocco and Tlemcen. Their principal existing monument is the city of Marrakesh. In 1149 the Murabti power was overthrown by another religious leader, `Abd el Mumin at the head of the Muwabhadi horde (see ALMOHADES), under whom the Moorish empire reached its zenith at the close of the 12th century. It then included, in addition to the Murabti realm, what now are Algeria, Tunisia and Tripoli, extending to the frontier of Egypt, which they were prevented from occupying by the rise of Saladin. Before the middle of the 13th century they had been driven out of Spain, and had lost all but what is now known as Morocco, whence, between I 7 and 1269, they were ousted by the Beni Marin (Marinides). (See ALMORAVIDES and ALMOHADES.) Beni Marin Period, 1213-1524.--The new dynasty differed from the two which had preceded it in being frankly part of a Berber tribe, the Zenata, who carved out a kingdom for them selves. Having assisted the Murabtis and Muwahhadis respec
tively at the battles of El Arcos (1195) and Las Navas (1212), the defection of their amir on that occasion offered an opportunity for Abd-el-Halsls, the son of their general, to attempt the over throw of the reigning house. At first the Beni Marin professed al legiance to Tunis, where the Hafsis, a branch of the Muwahhadis, had thrown off the Moorish yoke and secured acknowledgement in northern Morocco and parts of Spain. But they were soon in a position to proclaim complete independence, and by the time that Abu Bakr, the third son of Abd-el-Hal5k to succeed him, died, in 1258, they held sway over all that is now known as Morocco, and 1269 saw the death of the last Muwahhadi prince.
On the death of Abu Bakr there succeeded Yakilb II., one of the few amirs of Morocco who have left a name for just adminis tration and for philanthropic undertakings. Although of strict religious habits, he displayed no bigotry, studying philosophy, and entering into friendly intercourse with Europeans, whom he encouraged to trade with Salli. In 1261, 1275 and 1277-79, he undertook successful expeditions to Spain, and again in 1284, this time, in alliance with Alphonso of Leon, against his rebel son Sancho. But Alphonso dying during the struggle, Yakilb found himself master of his country, and Sancho had to acknowledge his suzerainty. All Mohammedans within his realm were freed from all taxes, and all the Arabic manuscripts of the country 13 loads—were despatched to the college YakUb had built in Fez.
But Yakub did not live to reap the benefits of his conquest, which were enjoyed by his son, Yusef IV. (1286), who was courted by his father's old foes, entering into amicable relations with Tunis, Egypt, Arabia and the neighbouring European States. With the contemporaneous Beni Zeiyan dynasty of Tlemcen, sworn foes of his house, however, he was still at war when stabbed (1307) in the new town of Tlemcen, which he had built while con ducting a siege of the old town. A second siege was begun in 1335, and Tlemcen fell in 1337 to the fourth ruler of the dynasty, Ali V., Abu '1 Hasan, better known as "The Black Sultan." Un successful in his invasion of Spain and Tunisia, Ali had eventually to abdicate in 1351 in favour of his rebel son, the famous "Abu Ainan," Faris I., who, during a short reign recovered Algeria and Tunisia.