The Kingdom of Nekor (Arabic: مملكة نكور) was an emirate in the Rif area of modern day Morocco, with its capital initially at Temsaman but later at Nekor. It was founded by an immigrant of Yemen, Salih I ibn Mansur al-Himyarī in 710 AD, by Caliphal grant. He converted the local Berber tribes to Islam; they soon tired of the restrictions of the religion, and threw him out in favor of a person known as az-Zaydi from the Nafza tribe, but then changed their mind and took him back, and his dynasty, the Banū Sālih, ruled the region until 1019.
On the east, it included the tribes of Zouagha and Djeraoua of Ibn Abī l-ˤAys, about five days' journey from Nekor, bordering on the territory of the Matmata, Kebdana, Mernissa, Ghassasa of Mt. Herek and Quluˤ Jarra belonging to the Banū Urtendi. On the west, it extended to the Banū Marwan of Ghomara and the Banū Humayd and bordered the Mestassa and Senhaja. Behind these lay the Awraba, the band of Ferhun, the Banū Walīd, the Zenata, the Banū Irnian and the Banū Merasen of the band of Qāsim, Lord of Sa. In the north, it was bounded by the sea, some five miles from Nekor. In short, it comprised most of the MoroccanRif.
Sa'id I ibn Idris (760-803), who moved the capital to Nekor. In his reign, Nekor was sacked by the Normans, who took many prisoners, a few of whom were ransomed by the Umayyad ruler of Spain. Later, part of the Ghomara tribe revolted, led by a person called Segguen; their revolt was defeated.
Sa'id I ibn Salih (864-916); his older brother and uncle led an unsuccessful revolt against him, but he was ultimately defeated and killed by the Fatimid general Messala ibn Habus, who conquered the area for six months. However, his sons took refuge in Málaga with the Umayyadcaliph, and returned once Messala had left the region and successfully expelled his garrison.
Salih III ibn Sa'id (917-927); in gratitude, he acknowledged the Umayyads as the rightful caliphs, thus transferring his nominal allegiance.
Abd al-Badi' ibn Salih "el-Mu'ayyid" (927-929); he was defeated and killed by another Fatimid general, Musa ibn Abi'l-Afiya, who destroyed Nekor again. However, the line was resumed (and the city rebuilt) by:
Abu Ayyub Isma'il ibn 'Abd al Malik ibn Abd ar-Rahman ibn Sa'id I ibn Salih (930?-935), who was defeated and killed by yet another Fatimid general, Sandal the mawla. However, when Sandal departed for Fez, installing a governor called Marmazu of the Kutama tribe, the inhabitants rebelled and installed yet another member of the line: