The Rif has been inhabited by Berbers since prehistoric times. As early as the 11th century BC, the Phoenicians began to establish trading posts, with approval of or partnership with the local Berbers and started interbreeding thus starting a Punic language, on the Mediterranean and Atlantic coasts, and founded cities such as Tetouan, Melilla and, in the 5th century BC, Tangier. Later the Phoenician power gave way to an independent Carthage city-state, as the major power in the region. After the Third Punic War, Carthage was supplanted by Rome, and the Rif became part of the province of Mauretania. When the latter was divided during the rule of Emperor Claudius, Tangier became the capital of Mauretania Tingitana. In the 5th century AD, the region was raided by the Vandals, and Roman rule came to an end. The region remained under Vandal control until the 6th century AD when the Byzantines reconquered parts of it.
In 710, Salih I ibn Mansur founded the kingdom of Nekor in the Rif and Berbers started converting to Islam. Berber Muslim kingdoms started establishing more cities. By the 15th century, many Spanish Moors were exiled from Spain and most of them settled in Western Rif, bringing their culture, Andalusian music, and even establishing the city of Ashawen or Chefchaouen. Since then, the Rif has suffered numerous battles between Berber kingdoms, Spain and Portugal. In 1415, Portugal invaded Ceuta, and in 1490 Spain invaded Melilla. There was a period of peace afterwards, but war between Spain and Morocco broke out again in 1859 in Tetouan, where Morocco was defeated. The Spanish-Moroccan conflicts continued in the 20th century, under the leadership of Abd el-Krim, the Berber guerrilla leader who proclaimed the Republic of the Rif in 1921. The Riffian Berbers won several victories over the Spanish in the Rif War of the 1920s before being eventually defeated. The region was added to Morocco's reign by Spain in April 1956, a month after the former gained its independence from France.
Environment
According to C. Michael Hogan, there are between five and eight separate subpopulations of the endangeredprimateBarbary macaque, Macaca sylvanus. The Rif mountains are also home to the honey bee subspecies Apis mellifera major. The Rif region receives more rainfall than any other region in Morocco, with some portions receiving upwards of of precipitation a year. The western and central portions are more rainy and are covered in forests of Atlas cedar, cork oak and holm oak, as well as the only remaining forests of Moroccan fir, a subspecies of the Spanish fir. The eastern slopes receive less rainfall, and there forests consist mainly of pines, particularly the Aleppo pine and the maritime pine, as well as tetraclinis. Massive deforestation due to overgrazing, forest fires, and forest clearing for agriculture, particularly for the creation of cannabis plantations, has taken place over the last 60 years. This deforestation has led to soil degradation due to the washing away of topsoil, which has aggravated the process.