Indeed, the oldest remains of anatomically modern human beings have been found in Jebel Irhoud, at 315,000 years old, these are very important scientifically. Man-like hominids from Morocco date back even further, to 400,000 years ago, bones have been found near Salé.
Then there are the remains of cavemen found in a cave system near Oujda, where evidence of mankind's activities as old as 85,000 years have been found and actual remains from 15,000 years ago. Seashell beads with drilled holes were found here and are the earliest known examples of Human adornment; the very earliest jewellery at 82,000 years old. It seems that about 5,000 years BCE, the area became too dry and the original peoples died out, or left the country.
Actual recorded history starts with the arrival of the Phoenicians who sailed the Mediterranean and colonized parts of the Moroccan coast between the 8th and 6th centuries BCE, although the area had been home to the indigenous Berber people for a minimum of 2,000 years before the Phoenicians' arrival. The Phoenicians built settlements at Chellah, Lixus and Mogador, where interesting archaeological sites can still be visited today. From their capital at Carthage (modern day Tunisia) the Phoenicians paid annual tribute to the Berbers in return for being allowed to exploit Morocco's raw materials.
Soon, Morocco became the independent Berber Kingdom of Mauretania which began in about the 3rd century BCE and records dealings with Phoenician and Carthaginian settlers and traders on the coast. The first known King was Bocchus I who ruled from about 110 to 81 BCE.
Then, the Romans came, first existing alongside the Carthaginians but then annexing Morocco in 33 BCE and making it a full province in 40 AD after the Emperor Caligula had the last Berber King, Ptolemy, grandson to Anthony and Cleopatra, executed. It is said that Ptolemy wore a magnificent purple cloak to the Roman court and Caligula had him poisoned in a fit of jealousy. There followed an uprising in Mauretania which was suppressed and Morocco split into the two Kingdoms of Mauretania Tingetana and Mauretania Caesariensis, roughly equivalent to Morocco and Algeria respectively. Many Roman ruins may be visited in the coastal regions and north of Morocco, though they never went very far south. The most famous is at Volubilis where there is a new museum and visitor centre and the Triumphal Arch, Shops and streets and many fine mozaics may still be seen by curious tourists. Volubilis became a rich and powerful Roman settlement and the capital of Roman Morocco, though during the reign of the Emperor Augustus, Berber Kings such as Juba II were allowed to rule on behalf of Rome. In 278 the Romans moved their capital to Tangier and the slow decline in the importance of Volubilis began.
Christianity was introduced in the 2nd century AD and many Romans and Berbers began to convert, until by the 4th Century, the Roman occupied northern areas had been Christianized and many of the southern Berber tribes followed suit, sometimes converting en masse. The numbers of Jews in the country also increased dramatically at this time.
The Arab conquest began in the middle of the 7th century and was completed by the beginning of the 8th. The Berbers seem to have readily accepted Islam, but were not so keen on the Arabic language and positively detested Arab rule. A revolt followed and lasted from 740 to 743 resulting in the Arabs being thrown out of Morocco and the country being divided into several Berber Kingdoms.
Among these, the Idrissid dynasty (789-974) are said to have created the first Moroccan state.
During this time, in 859 the Vikings arrived with 62 ships and defeated the Moorish army. They stayed 8 days before deciding to leave and go and plunder Spain instead.
In the 900s, the Fatimids arrived and for many years, they, the Ummayads and the Zenata Berber chieftains wrestled for control of the country.
From 1060 until 1549 a succession of Berber Dynasty's, originating in the south and each spreading its influence slowly north, reigned.
First ,the Almoravids defeated the Zenata and the other independent Emirates to unify the country. They also beat the Christian forces in Al-Andalus (Spain) but lost power after a defeat in battle by the Portuguese and the conquest of Marrakech by the Almohad Dynasty in 1147. The Almohads went on to conquer Al-Andalus, also.
Then, the Marinid dynasty took power after a four year struggle between 1244 and 1248. They lost possession of the Iberian Peninsula and were succeeded in 1471 by the Wattasid Dynasty, also of Zenata Berber origin.
In 1549 Berber rule was ended by the Arab Saadi Dynasty, who, like the succeeding Arab Dynasty, all claimed descent from the Prophet Mohammed (PBOH).
The current Dynasty, the Alaouites, seized power in 1666 and have ruled ever since. Unlike previous dynasties the Alaouites had the support of not one single Berber or Bedouin tribe and had to rely on armies of slaves, often black Africans. Ismail ibn Sharif unified the country driving the Spanish from Larache and the English from Tangier, where they had introduced tea to Morocco! After Ismail's death, tribal conflict resumed until 1757-1790 under the rule of Mohammed III when central government was rejected in favour of autonomous tribes ruling each area.
On the 20th December 1777 Morocco became the first country to accept US independence from Britain, much to the annoyance of the British, who hadn't yet recognized it themselves.
Mohammed IV and Hassan I consolidated control over the Berber and Bedouin tribes and sought foreign trade deals, fought a war with Spain in 1859, and this resulted in the French gaining influence over Morocco. Germany countered this leading to a couple of confrontations until Morocco became a French protectorate in 1912 at the Treaty of Fes. A second treaty in the same year gave Spain control of some areas in the North and South. In 1923, Tangier became an international zone. Officially, the sultan was still ruler, but in effect he was just a puppet.
Moroccan troops fought for the French army in both world wars.
In 1921 The Republic of the Rif was declared in Northern Morocco, but after inflicting heavy casualties on the Spanish, joint French and Spanish forces ended the uprising in 1926. It was France's exile of Sultan Mohammad V in 1953 that finally unit"ed Morocco and led to protests and violence against the French, finally leading to negotiations that saw Moroccan independence in 1956. Mohammed the V had returned and began establishing a constitutional monarchy with an elected government under the control of a king. He officially became King in 1957.