Morocco, officially the Kingdom of Morocco, is a country in the Maghreb region of North Africa. It has coastlines on the Mediterranean Sea to the north and the Atlantic Ocean to the west, and has land borders with Algeria to the east; the Spanish exclaves of Ceuta, Melilla and Peñón de Vélez de la Gomera along the north, which it claims together with several small Spanish-controlled islands; and the disputed territory of Western Sahara to the south, partly occupied by Morocco since 1975. Morocco also claims to share a border with Mauritania through the disputed territory of Western Sahara. It has a population of approximately 37 million. Its capital is Rabat, while its largest city is Casablanca.

The region constituting Morocco has been inhabited since the Paleolithic era, more than 300,000 years ago. The Moroccan state traces its origins to the establishment of the Idrisid dynasty by Idris I in 788, although its historical territories did not coincide with those of present-day Morocco; the country is regarded as one of the world's oldest continuously existing states. Morocco was subsequently ruled by a series of other independent dynasties, reaching its zenith as a regional power in the 11th and 12th centuries, under the Almoravid and Almohad dynasties, both Berber kingdoms, when it controlled the southern and eastern Iberian Peninsula and the Maghreb. In the 15th and 16th centuries, Morocco faced external threats to its sovereignty, with Portugal seizing some territory and the Ottoman Empire encroaching from the east. The Marinid and Saadi dynasties otherwise resisted foreign domination, and Morocco was the only North African nation to escape Ottoman dominion. The Saadi dynasty expanded its territory through the conquest of the Songhai Empire in the late 16th century. The Alawi dynasty, which rules the country to this day, seized power in 1631, and over the next two centuries expanded diplomatic and commercial relations with the Western world. It is among the world's oldest reigning royal dynasties. Morocco's strategic location near the mouth of the Mediterranean drew renewed European interest. In 1912, France and Spain established protectorates over the country and designated Tangier as an international zone, while the Sultan remained the formal sovereign with limited authority under colonial control. Following intermittent riots and revolts against colonial rule, Morocco regained its independence and reunified in 1956 under the leadership of Sultan Mohammed V.

Since independence, Morocco has remained relatively stable. It has the fifth-largest economy in Africa and wields significant influence in both Africa and the Arab world; it is considered a middle power in global affairs and holds membership in the Arab League, the Arab Maghreb Union, the Union for the Mediterranean, and the African Union. It is one of the few countries in Africa ranking high on the Human Development Index and is Africa's leading industrial economy. Morocco is a unitary semi-constitutional monarchy with an elected parliament. The executive branch is led by the King of Morocco and the prime minister, while legislative power is vested in the two chambers of parliament: the House of Representatives and the House of Councillors. Judicial power rests with the Constitutional Court, which may review the validity of laws, elections, and referendums. The king holds vast executive and legislative powers, especially over the military, foreign policy and religious affairs; he can issue dahirs, decrees which have the force of law, and he can also dissolve the parliament after consulting the prime minister and the president of the constitutional court. Morocco is classified as a hybrid regime and, as of 2025, holds the highest ranking in the Arab world, according to The Economist Democracy Index. Islam is both the official and predominant religion, with nearly all of the population identifying as Muslims. Arabic and Berber are the official languages, though the Moroccan dialect of Arabic (known locally as Darija) is widely spoken and considered the lingua franca. The culture of Morocco is a mix of Arab, Berber, Andalusian, and African cultures.

Morocco claims ownership of the non-self-governing territory of Western Sahara, which it has designated its Southern Provinces. In 1975, after Spain agreed to decolonise the territory and cede its control to Morocco and Mauritania, a guerrilla war broke out between those powers and some of the local inhabitants. In 1979, Mauritania relinquished its claim to the area, but the war continued to rage. In 1991, a ceasefire agreement was reached, but the issue of sovereignty remained unresolved. Today, Morocco occupies about two-thirds of the territory, and efforts to resolve the dispute have thus far failed to break the political deadlock.

Etymology and name The English Morocco is an anglicisation of the Spanish name for the country, , derived from the name of the city of Marrakesh, which was the capital of the Almoravid dynasty, the Almohad Caliphate, and the Saadian dynasty. During the Almoravid dynasty, the city of Marrakesh was established under the name of , derived from the city's ancient Berber name of (). In English, the first vowel has been changed, likely influenced by the word "Moor."

Morocco's local name stems from the Arabic (, ), with the Kingdom's official Arabic name being (; ) and official Berber name ().

The term Maghrib was introduced by the Arabs after the Muslim conquest of the Maghreb.

Historically, Morocco has been part of what Muslim geographers referred to in Arabic as (, 'the Farthest West [of the Islamic world]' designating roughly the area from Tiaret to the Atlantic) in contrast with neighbouring regions of (, 'the Middle West': Tripoli to Béjaïa) and (, 'the Nearest West': Alexandria to Tripoli).

In Turkish, Morocco is known as , a name derived from its medieval capital of Fes (). In other parts of the Islamic world, for example in Egyptian and Middle Eastern Arabic literature before the mid-20th century, Morocco was commonly referred to as (). The term is still used to refer to Morocco today in several Indo-Iranian languages, including Persian, Urdu, and Punjabi.

Morocco has also been referred to politically by a variety of terms denoting the Sharifi heritage of the Alawi dynasty, such as (), () and (), rendered in French as and in English as the 'Sharifian Empire'.

History

Prehistory and antiquity

The area of present-day Morocco has been inhabited since at least Paleolithic times, beginning sometime between 190,000 and 90,000 BC. A recent publication has suggested that there is evidence for even earlier human habitation of the area: Homo sapiens fossils that had been discovered in the late 2000s near the Atlantic coast in Jebel Irhoud were recently dated to roughly 315,000 years ago. Hominin fossils from Thomas Quarry I in Casablanca, published in 2026, push evidence of hominin presence in the region back to approximately 773,000 years ago, near the root of the Homo sapiens lineage. During the Upper Paleolithic, the Maghreb was more fertile than it is today, resembling a savanna, in contrast to its modern arid landscape.

DNA studies of Iberomaurusian peoples at Taforalt, Morocco dating to around 15,000 years ago have found them to have a distinctive Maghrebi ancestry formed from a mixture of Near Eastern and African ancestry, which is still found as a part of the genome of modern Northwest Africans. Later during the Neolithic, from around 7,500 years ago onwards, there was a migration into Northwest Africa of European Neolithic Farmers from the Iberian Peninsula (who had originated in Anatolia several thousand years prior), as well as pastoralists from the Levant, both of whom also significantly contributed to the ancestry of modern Northwest Africans. The proto-Berber tribes evolved from these prehistoric communities during the late Bronze- and early Iron ages.Mário Curtis Giordani, História da África. Anterior aos descobrimentos. Editora Vozes, Petrópolis (Brasil) 1985, pp. 42f., 77f. Giordani references Bousquet, Les Berbères (Paris 1961).

Excavations at Oued Beht uncovered a Neolithic farming society dated to 3400–2900 BCE, the largest known agricultural complex in Africa outside the Nile Valley at that time. At Kach Kouch near the Strait of Gibraltar, Bronze Age occupation from 2200 BCE onward demonstrates settled agricultural life in the Maghreb centuries before Phoenician contact, by the 8th century BCE its inhabitants were selectively adopting Phoenician building techniques and crops while maintaining their own material culture.

In the early part of Classical Antiquity, indigenous communities in the region were already integrated into Mediterranean exchange networks when the Phoenicians established trading colonies and settlements, the most substantial of which were Chellah, Lixus, and Mogador. Mogador was established as a Phoenician colony as early as the 6th century BC.

Morocco later became a realm of the Northwest African civilisation of ancient Carthage, and part of the Carthaginian empire. The earliest known independent Moroccan state was the Berber kingdom of Mauretania, under King Baga.Livy Ab Urbe Condita Libri 29.30 This ancient kingdom (not to be confused with the modern state of Mauritania) flourished around 225 BC or earlier. Mauretania became a client kingdom of the Roman Empire in 33 BC. Emperor Claudius annexed Mauretania directly in 44 AD, making it a Roman province ruled by an imperial governor (either a procurator Augusti, or a legatus Augusti pro praetore).

Christianity in Morocco appeared during the Roman times, when it was practiced by Berber Christians in Roman Mauretania Tingitana. During the Crisis of the Third Century, parts of Mauretania were reconquered by Berbers. By the late 3rd century, direct Roman rule had become confined to a few coastal cities, such as Septum (Ceuta) in Mauretania Tingitana and Cherchell in Mauretania Caesariensis. When, in 429 AD, the area was devastated by the Vandals, the Roman Empire lost its remaining possessions in Mauretania, and local Mauro-Roman kings assumed control of them. In the 530s, the Eastern Roman Empire, under Byzantine control, re-established direct imperial rule of Septum and Tingi, fortified Tingis and erected a church.

Foundation and dynasties

The Muslim conquest of the Maghreb that had begun during the mid-7th century was completed under the Umayyad Caliphate by 709. The caliphate introduced both Islam and the Arabic language to the area; this period also saw the beginning of a trend of Arab migration to the Maghreb which would last for centuries and effect a demographic shift in the region. While constituting part of the larger empire, Morocco was initially organised as a subsidiary province of Ifriqiya, with the local governors appointed by the Muslim governor in Kairouan.Abun-Nasr 1987, p.33

The indigenous Berber peoples adopted Islam, but retained their customary laws. They also paid taxes and tribute to the new Muslim administration.Abun-Nasr 1987, pp. 33–34 The first independent Muslim state in the area of modern Morocco was the Kingdom of Nekor, an emirate in the Rif Mountains. It was founded by Salih I ibn Mansur in 710, as a client state to the Umayyad Caliphate. After the outbreak of the Berber Revolt in 739, the Berbers formed other independent states such as the Miknasa of Sijilmasa and the Barghawata.