History of human habitation in Morocco spans since Lower Paleolithic, with the earliest known being Jebel Irhoud. Much later Morocco was part of Iberomaurusian culture, including Taforalt. It dates from the establishment of Mauretania and other ancient Berber kingdoms, to the establishment of the Moroccan state by the Idrisid dynasty followed by other Islamic dynasties, 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 BCE, although the area was inhabited by indigenous Berbers for some two thousand years before that. In the 5th century BCE, the city-state of Carthage extended its hegemony over the coastal areas. They remained there until the late 3rd century BCE, while the hinterland was ruled by indigenous monarchs.Indigenous Berber monarchs ruled the territory from the 3rd century BCE until 40 CE, when it was annexed to the 6th century.