▁ 5 3 0 s . ▁T ing is ▁was ▁fort ified ▁and ▁a ▁church ▁ere cted . ▁ ▁Foundation ▁and ▁early ▁Islam ic ▁era ▁ ▁The ▁Muslim ▁con quest ▁of ▁the ▁Mag h reb , ▁that ▁started ▁in ▁the ▁middle ▁of ▁the ▁ 7 th ▁century , ▁was ▁achieved ▁by ▁the ▁Um ay y ad ▁C ali ph ate ▁early ▁into ▁the ▁following ▁century . ▁It ▁brought ▁both ▁the ▁Arab ic ▁language ▁and ▁Islam ▁to ▁the ▁area . ▁Although ▁part ▁of ▁the ▁larger ▁Islam ic ▁Empire , ▁Mor oc co ▁was ▁initially ▁organized ▁as ▁a ▁subs idi ary ▁province ▁of ▁If ri qi ya , ▁with ▁the ▁local ▁govern ors ▁appointed ▁by ▁the ▁Muslim ▁governor ▁in ▁K air ou an . ▁ ▁The ▁ind igen ous ▁Ber ber ▁tribes ▁adopted ▁Islam , ▁but ▁retained ▁their ▁custom ary ▁laws . ▁They ▁also ▁paid ▁tax es ▁and ▁t ribute ▁to ▁the ▁new ▁Muslim ▁administration . ▁The ▁first ▁independent ▁Muslim ▁state ▁in ▁the ▁area ▁of ▁modern ▁Mor oc co ▁was ▁the ▁Kingdom ▁of ▁N ek or , ▁an ▁em ir ate ▁in ▁the ▁R if ▁Mountains . ▁It ▁was ▁founded ▁by ▁S ali h ▁I ▁ibn ▁Mans ur ▁in ▁ 7 1 0 , ▁as ▁a ▁client ▁state ▁to ▁the ▁Um ay y ad ▁C ali ph ate . ▁After ▁the ▁out break ▁of ▁the ▁Ber ber ▁Revol t ▁in ▁ 7 3 9 , ▁the ▁Ber bers ▁formed ▁other ▁independent ▁states ▁such ▁as ▁the ▁Mik n asa ▁of ▁S ij il mas a ▁and