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 most of the 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, European (specifically 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.
The English Morocco is an anglicisation of the Spanish name for the country, Marruecos, 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 Tāmurākušt, derived from the city's ancient Berber name of amūr n Yakuš (lit. 'land/country of God'). In English, the first vowel has been changed, likely influenced by the word "Moor."
Morocco's local name stems from the Arabic al-Maghrib (المغرب, transl. the land of the sunset; the west), with the Kingdom's official Arabic name being al-Mamlakah al-Maghribīyah (المملكة المغربية; transl. the kingdom of sunset; the western kingdom) and official Berber name Tageldit n Lmeɣrib (ⵜⴰⴳⵍⴷⵉⵜ ⵏ ⵍⵎⵖⵔⵉⴱ).
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 al-Maghrib al-Aqṣā (المغرب الأقصى, 'the Farthest West [of the Islamic world]' designating roughly the area from Tiaret to the Atlantic) in contrast with neighbouring regions of al-Maghrib al-Awsaṭ (المغرب الأوسط, 'the Middle West': Tripoli to Béjaïa) and al-Maghrib al-Adnā (المغرب الأدنى, 'the Nearest West': Alexandria to Tripoli).
In Turkish, Morocco is known as Fas, 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 Murrakush (مراكش). 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 al-Mamlakah ash-Sharīfah (المملكة الشريفة), al-Iyālah ash-Sharīfah (الإيالة الشريفة) and al-Imbarāṭūriyyah ash-Sharīfah (الإمبراطورية الشريفة), rendered in French as l'Empire chérifien and in English as the 'Sharifian Empire'.
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.