The Phoenicians explored this corner of Africa around 1000BC and found the area away from the coast to be inhabited by people they called barbaroi (meaning "not our people"), which later became known as the Berbers. The Berbers may have had links with the Celts, Basques, or tribes from the Lebanon.
Around 150 years BC, the Romans added this part of the north African coast to their empire but did not generally disturb the Berbers who were further inland and in the mountains.

The 7th century AD saw the Arab armies spread across northern Africa and into Morocco. They didn't stop there of course, joining with the Berbers, they invaded most of Spain, where they had a presence for around 600 years.

In 788, a descendant of the Prophet Mohammed, named Moulay Idriss, was proclaimed king by the Berber tribes. Moulay Idriss quickly became powerful and influential but was murdered by a rival. The village which is the location of his tomb is now called Moulay Idriss and is one of the most sacred shrines in Morocco.
The son Moulay Idriss, Moulay Idriss II took over and founded the present city of Fez, the capital at that time. After his death in 828, power was split between several sons, resulting in a weakness of leadership.

In the mid 11th century, an army of strict muslims moved out from their fortified monastery in the desert to the south and conquered southern Morocco, destroying musical instruments and drinking places as they went. These Almoravids eventually captured Fez, after founding their own capital at Marrakech and later had influence in Spain also.

Later, in the mid 12th century, another fanatic group, the Almohads, moved from their fortified monestry in the Atlas mountains to take control of all northern Africa and much of Spain.
Eventually the Almohads were weakened by infighting and in the mid 13th century the Beni Merin Berber tribe took control. The Merinids were more materialistic than their predecessors and built some fine buildings, including the Alhambra at Granada, Spain.

After the Christians eventually pushed the Moors (Arabs and Berbers) out of Spain, the Spanish and Portuguese invaded the Moroccan coastline (Spain still holds control of Ceuta and Melilla on the north Moroccan coast).
This encouraged the Saadi Arab tribe from the Draa valley to move north and eventually take control during the mid to late 16th century, bringing King Ahmed el Mansour to power. The Saadians lavished much wealth on Marrakech.

After King Ahmed's death in the early 17th century, the Saadians power fell apart and allowed the Alaouites to take control under the sultan Moulay Ismail. In fact the Alaouites were invited by the people of Fez to restore order to the country. Ismail was believed to be cruel and ruthless but was also a leader and restored order.
The Alaouites kept control for over two centuries but during the 19th century, Morocco became increasingly dependent on France (Europe had been colonising Africa and the French had taken control of Morocco's neighbour, Algiers).

In 1912. Morocco became a Franco-Spanish protectorate but with an Alaouite sultan, chosen by the French. The French controlled the central and southern areas while the Spanish controlled north. Tangiers was an international zone and Rabat the capital.
During this time the Franco Spanish influence resulted in roads, railways and schools being built and many new towns were built beside the old.

The second world war weakened the position of the French and there were as strong movement for independence. To control this, the French exiled the sultan Mohommed V to Corsica but only succeeded in strengthening the independence movement.
Eventually the French had to bring Mohamed V back and he became king in 1956 when independence was declared.

King Mohamed V died suddenly in 1961 and was succeeded by his son, Hassan II, who introduced a Social, Democratic and Constitutional monarchy, with elections for the parliament every 6 years but power remaining with the king.

The present king, Mohommed VI, succeeded king Hassan II on his death in 1999, has continued his fathers progressive reforms of health, education, and economics.
Morocco is modernising but also retaining it's culture which is a fascination to visitors.