From what is known, the Phoenicians were the first to establish trading posts in Morocco around 1100BC. By 200 BC, the Phoenician empire slowly ended, but the refugees from Carthage insured the growth of the area. Around 0BC, a Berber kingdom was established in the northwestern part of Morocco. Half a century later, the Roman empire imposed direct rule over the region, and was called Mauretania Tingitana. After two centuries of hard resistance from local rulers, the Romans were forced to withdraw. By 429, Mauretania Tingitana was occupied by the Germanic tribe of Vandals, and by 533, Byzantine rule was established in the coastal north and northwest.
In 681 was the first introduction to Islam with the arrival of Ugba Ibn Nafi with a 5000km trek around the country. He was defeated two years later by a chieftain, and his muslim forces were forced to leave the country. From then on, arab culture and islam started growing. A Shi’I refugee, named Moulay Idriss establishes an infrastructure for an arab state in the central area of Morocco. He was recognized as Imam, and with him, the line of Moroccan rulers was started, with the Idrissid dynasty. In 807, Moulay Idriss 2 took power, and extended the control to the northern mountains, and the oasis to the south of the Atlas Mountains, and made Fez his capital. The Idrisid dynasty fell apart in the 10th century, and Morocco was divided into smaller kingdoms
The Berber dynasty, the Almoravids united Morocco, extended the territory; from the deep Sahara up to Spain, and all the way to Libya on the east. The ruler Yousef actually took control of Spain, which overextended their forces, and was the beginning of the end for the Almoravids. They were under much internal pressure for their “immoral” lifestyles, like, allowing women to ride horses, playing music, drinking wine, and having an incorrect theology, by a tribe in the High Atlas, whose leader was Ibn Tumart. He claimed to be the Mahdi, the final prophet of Islam. Even after his death, his group, the Almohads, became so strong, they took over power in Fez, and in 1147, out of Marrakech as well. They continued to grow over the centuries, securing control over Spain, but they overextended themselves, and, in 1212, disintegrated and large parts of the country came under the control of small tribes.
In 1248, a local tribe, the Merenids conquered Fez, which began a period of decline and disintegration. In 1415, the Portuguese took over Sebta (modern Ceuta), and, in 1465, the Merenids took control over Morocco. By 1492, a large influx of Spanish refugees brought strong economic growth. The Saadiens overtook the Merenids, and established their capital in Taroudannt. In 1603, Morocco fell into civil war, and divided into smaller sultanates. In 1660, The Sharifian replaced the Saadians, and their dynasty still rules today. Moulay Slimane cut off relations with Europe in the 19th century, and banned exports to Europe. Morocco was forced to turn Tangier into an international administration zone by Spanish and French interference. In 1894, a 10 year-old Abdu I-Aziz inherited control, and Europeans became the main advisors of the court, granting more control to local rulers.
France made agreements with the UK and Italy over the spheres of influence in Africa, leaving Morocco within its control. In 1907, France occupied Oujda, and invaded Casablanca. Moulay Hafiz deposed his brother Abdu I-Aziz, but could not resist France. In 1909, Spain sent 90000 troops to Melilla, its enclave in Morocco. Moulay Hafiz was finally trapped, and concluded final agreements with France. It did the same in 1912 with Spain, who occupied most of the northern coast, and areas in the south. Sultan Muhammad 5 was exiled in 1953, and the French unsuccessfully tried to name a successor. In 1955, they were forced to allow him to return, but it was not enough to quell the unrest.
In March, 1956, France gave full independence to Morocco, followed by Spain in April, and in October, the free zone of Tangier was given back. In December of 1962, a new constitution was approved by a popular referendum, made to secure the king and his power, within the confines of democratic structures. In 1963, the first general elections were held. A plot to kill the king was discovered, and political parties were charged with implication. In June 1965, King Hassan suspended the parliament, and assumed full executive and legislative powers. He was also named the prime minister until 1967. In 1969, Spain returned Ifni to Morocco. King Hassan annexed the northern two-thirds of the Western Sahara, which brought Morocco into war with Polisario. In 1979 Mauritania withdrew from the southern part of Western Sahara, giving Morocco that part as well. Polisario entered war with Morocco, and paralyzed Morocco’s infrastructure and mining economy.
The 1990’s were a great time to modernize structures, and in 1992, Western Sahara was included in local elections. In 1993, none of the parties involved in elections could form a government, and King Hassan had to appoint a nonpolitical government. In 1995 King Hassan appointed a new government with members of the conservative parties. In 1996, Morocco signed the Euro-Mediterranean Partnership that was designed for future free trade with the EU. In 1997, the socialist party won, and in 1998, for the first time, Morocco had a government formed by opposing politicians. In July, 1999 King Hassan died, and his son, Muhammad 6 took the throne.