The history of Morocco spans several millennia, succeeding the prehistoric cultures of Jebel Irhoud and Taforalt. It dates from the establishment of Mauretania and other ancient Berber kingdoms, to the formation of the Almoravid dynasty, Idrisid dynasty and other Islamic polities, through to the colonial and independence periods.Archaeological evidence has shown that the area was inhabited by hominids at least 400,000 years ago. The recorded history of Morocco begins with the Phoenician colonization of the Moroccan coast between the 8th and 6th centuries BC, although the area was inhabited by indigenous Berbers for some two thousand years before that. In the 5th century BC, the city-state of Carthage extended its hegemony over the coastal areas. They remained there until the late 3rd century BC, while the hinterland was ruled by indigenous monarchs. Indigenous Berber monarchs ruled the territory from the 3rd century BC until 40 AD, when it was annexed to the Roman Empire. In the mid-5th century AD, it was overrun by Vandals, before being recovered by the Byzantine Empire in the 6th century.The region was conquered by the Muslims in the early 8th century AD, but broke away from the Umayyad Caliphate after the Berber Revolt of 740. Half a century later, the Moroccan state was established by the Idrisid dynasty. Under the Almoravid and the Almohad dynasties, Morocco dominated the Maghreb and Muslim Spain. The Saadi dynasty ruled the country from 1549 to 1659, followed by the Alaouites from 1667 onwards, who have since been the ruling dynasty of Morocco.In 1912, after the First Moroccan Crisis and the Agadir Crisis, the Treaty of Fez was signed, dividing Morocco into French and Spanish protectorates. In 1956, after 44 years of French rule, Morocco regained independence from France, and shortly afterward regained most of the territories under Spanish control.
||Requires Android 4.0.3 and up