The Berbers, the earliest known inhabitants of Morocco, suffered successive waves of invaders in ancient times: the Phoenicians, Carthaginians, Romans (1st century BC ), Vandals (5th century AD ), and finally the Byzantines (6th century). In 682, when the Arabs swept through North Africa, Okba (Uqba ibn-Nefi) conquered Morocco. Under successive Moorish dynasties, beginning with Idris I (Idris bin 'Abdallah) in 788, the Berber tribes were united and the Islamic faith and Arabic language adopted. The Idrisid dynasty, an offshoot of the Umayyad dynasty, with its capital at Fès (founded in 800), lasted until 974, when it was overthrown by the Berbers. Rising in the Sahara in the early 11th century, the powerful Muslim sect of the Almoravids extended its conquests over North Africa and ultimately into Spain. 'Abdallah bin Yasin, its chief, was proclaimed ruler over Morocco in 1055. In 1147, the Almohad sect (Al-Muwahhidun), led by 'Abd al-Mumin bin 'Ali, conquered the Almoravids and ruled Morocco until 1269, when the Marinid (Beni Marin) dynasty came to power.
In the 16th century, the Sa'udi dynasty, the new monarchical line, began. Ahmad al-Mansur (called Ad-Dahabi, "the Golden"), the greatest of the Sa'udi kings, ruled from 1578 to 1603 and inaugurated the golden age of Moroccan history. He protected Morocco from Turkish invasion, strengthened the country's defenses, reorganized the army, and adorned his magnificent capital at Marrakech with the vast booty captured in Timbuktu (1591). The decadence of the last Sa'udi kings brought Morocco under the control of the Filali dynasty, of mixed Arab and Berber descent, which continued to modern times.
Trade with France and other European countries became increasingly important in the 18th and 19th centuries, and when the French in 1844 defeated the combined Moroccan and Algerian forces at Isly, France became the ascendant power. Spain, under an agreement with France, invaded and occupied northern Morocco in 1860. There followed some 45 years of trade rivalry among the European nations in Morocco. The Act of Algeciras, signed on 7 April 1906 by representatives of the United States, Germany, the UK, France, and Spain (among others), established the principle of commercial equality in Morocco and provided for a joint Spanish-French police force in Moroccan ports.
On 30 March 1912, after France had ceded some 260,000 sq km (100,000 sq mi) of the French Congo to Germany, the French imposed a protectorate in Morocco under Marshal Louis Lyautey. The Moroccans, led by 'Abd al-Karim, a guerrilla leader, fought for independence in the Rif War (1921–26) but were defeated by the combined French and Spanish forces, although sporadic fighting continued in Morocco until 1934.
A nationalist movement first took shape around the Plan of Reforms (1934) submitted to the French government by a group of young Moroccans. In 1934, the National Action Bloc was formed, and 'Alal al-Fasi became the uncontested nationalist leader. In December 1943, the Bloc was revived as the Istiqlal (Independence) Party, which during and after World War II pressed for independence and reforms. It received support from the Sultan, Sidi Muhammad bin Yusuf, later King Muhammad V, who became the symbol of the independence struggle. He was exiled in late 1953, and two years of terrorism ensued. After lengthy negotiations, the Franco-Moroccan agreement of 2 March 1956 granted independence, and Muhammad V became king of Morocco. Incorporated into the new nation was Tangier, once British territory, which had come under the rule of a consortium of powers in 1906 and since 1923 had been the center of an international zone.
After the death of Muhammad V on 26 February 1961, his son was crowned King Hassan II and became head of government. Hassan II increased his political power throughout the 1960s. In 1962, a constitutional monarchy was established, with the king retaining extensive powers. In June 1965, after student riots and other disorders, Hassan II declared a state of emergency and assumed all legislative and executive powers. A revised constitution promulgated in 1970 and approved by popular referendum gave the king broad personal power but reestablished parliament and ended the state of emergency. An attempted coup d'etat by right-wing army officers in July 1971 forced the king to accept, at least in principle, the need for a more broadly based government. A third constitution, approved by referendum on 1 March 1972, transferred many of the king's executive and legislative powers to a parliament which was to have two-thirds of its members directly elected. However, a second coup attempt in August 1972 caused the king to renew the emergency decrees.
In 1975, after Spain announced its intention of withdrawing from sparsely populated but phosphate-rich Spanish Sahara (now the Western Sahara), the king pressed Morocco's claim to most of the territory. Following the government's well-organized "Green March" of about 350,000 Moroccans into the territory in November, Spain ceded the northern two-thirds of the region to Morocco and the southern third to Mauritania. However, Algeria refused to recognize the annexation and supported the claim to the territory by guerrillas of the Popular Front for the Liberation of Saguia al-Hamra and Río de Oro, better known as Polisario. The movement, based in the Algerian border town of Tindouf, proclaimed Western Sahara as the Saharan Arab Democratic Republic (SADR). In 1979, Mauritania renounced its claim to the southern part of the territory, which Morocco then occupied and annexed. By the early 1980s, Morocco had moved up to 100,000 soldiers into Western Sahara in a costly effort to put down the Polisario revolt. The army built a wall of earth and sand around the productive northwestern coastal region, containing about 20% of the total area, the towns of El Aaiún and Samara, and phosphate mines; later, three-quarters of the Western Sahara was enclosed. In the meantime, Polisario received not only military support, mainly from Algeria and Libya, but also diplomatic support from some 50 countries and from the OAU, which in 1982 seated a delegation from the SADR, provoking a walkout by Morocco and more than a dozen other members. In 1984, Morocco resigned from the OAU when it seated the SADR at its annual summit meeting. Earlier, in 1981, the King's agreement under African pressure for a referendum in the territory provoked strong criticism from Morocco's Socialist Party.
In 1988, UN Secretary General Perez de Cuellar persuaded Moroccan and Polisario representatives to accept a peace plan that included a cease-fire (effective in September 1991) and a referendum for the territory on independence or integration with Morocco. The vote was scheduled for 1992 but has been blocked by disagreement by the two sides on details, especially over voter eligibility. The UN force sent to mediate the struggle, MINUSRO (UN Mission for the referendum in Western Sahara) has been struggling to hold the referendum. In 1997, UN Secretary General Kofi Annan sent former US Secretary of State James Baker to the region in hopes of ending the intransigence. Throughout the stalemate, the Moroccan government has repeatedly been accused of human rights violations in the Western Sahara.
On 13 August 1984, Morocco and Libya signed a treaty calling for a federation of the two countries. No concrete steps were taken, and Hassan II abrogated the pact following Libyan denunciation of the king for officially receiving Israeli Prime Minister Shimon Peres in July 1986. Israeli Prime Minister Rabin made a public visit in 1993 as the king continued to play a moderate role in the search for an Arab-Israel settlement. He also mediated the 1994 Israeli treaty with Jordan. In 1989, after a border agreement and restored relations with Algeria, Morocco promoted the formation of the Arab Maghreb Union of the states of North Africa. King Hassan's government maintains close relations with Sa'udi Arabia and the other Gulf states and was the first Arab nation to condemn the Iraqi invasion of Kuwait.
Austerity measures demanded by the IMF in return for new credits led to serious street riots in June 1984 in protest against an imminent price hike (subsequently canceled) for basic foodstuffs. In 1993, after pro-government parties won most local elections the previous year, parliamentary elections were held. The two largest opposition parties, the Istiqlal and USFP, won over 40% of the vote, but center-right parties of the ruling coalition gained a slim majority in the vote's second stage amid charges of election fraud. When the opposition refused to join in a new coalition, a cabinet of technocrats and independents was approved by the king under Prime Minister Mohamed Karim Lamrani, who promised to accelerate the privatization of state-owned enterprises.
Meanwhile, the country's political opposition grew quite vocal in their discontent, prompting government reprisals. The country's most famous Islamist politician, Abdelsalam Yassine, was imprisoned, and Istiqlal joined forces with an Islamist organization to form a substantial opposition party. In response, King Hassan proposed in 1996 to make all of parliament directly elected—previously, one-third of the deputies were appointed, giving the king power to undermine any opposition majority. The king also proposed the creation of a second chamber of advisers—a move seen by opposition parties as simply replacing one rubber stamp chamber with another. Still, the proposals were put to a vote on 13 September and approved by, officially, 99% of the population.
Elections for the new chambers were scheduled for 1997. In the months leading up to the elections, opposition skepticism waned as the government made repeated assurances that voting would be fair and the results would be respected. In June 1997 elections for 24,523 municipal council and commune seats were held and judged to be fair. The Bloc democratique won 31.7% of the seats, but control remained for the Entente nationale with 30.3% and the RNI, 26.4%. Following the local elections, legislation in 1997 set up the new bicameral parliament approved in the 1996 constitutional referendum. The Chamber of Representatives would consist of 325 members directly elected for a five-year term. The Chamber of Advisors would be made up of 270 members selected by indirect election: 162 would represent local authorities, 81 trade chambers, and 27 employees' associations. In the same 1996 referendum 16 new regional councils, with members chosen for six-year terms by indirect election through an electoral college representing professions and local governments, had been established, and elections for these took place in October 1997.
The Chamber of Representatives elections took place on 14 November 1997. Fifty-eight percent of the voters participated. The Bloc democratique won 34.3% of the vote, the Entente nationale 24.8%, and the center-right parties 27.3%. In a direct appeal to young voters on the part of most of the parties, 43% of the new chamber was made up of members under 45 years of age. Seventy percent of the Moroccan population is under 25 years of age. Indirect elections for the Chamber of Advisors were held on 5 December 1997. The right and center-right parties predominated, as was expected, winning 166 of the 270 seats. The new two-house parliament met for the first time in January 1998.
On 4 February 1998 King Hassan appointed Abd ar-Rahman el-Youssoufi, leader of the USFP, as prime minister. This was a groundbreaking event, as it was the first time an opposition member had been appointed prime minister. The Youssoufi government attempted to tackle corruption and promote transparency of government. Though results were, on the whole, disappointing, King Hassan praised the government in March 1999.
On 23 July 1999 King Hassan died of a heart attack. He was succeeded by his eldest son, as Mohammed VI. One of his first important moves was to dismiss King Hassan's longtime Interior Minister and advisor, Driss Basri. Basri had been considered the real power behind King Hassan, so this move gave a clear indication that Mohammed VI plans to reign in control of his government. Upon assuming the throne, he pledged his commitment to constitutional monarchy, political pluralism and economic liberalism. Mohammed VI claimed he would address problems of poverty, corruption, and Morocco's human rights record, and would engage in job creation. He is supported by reformers and the young, but is opposed by many Islamic conservatives.
Like most Islamic countries of the world, Morocco's government feels under threat from an internal Islamist movement, which itself is divided. The various groups have moved to fill the perceived void in social services: blood banks and medical clinics, food pantries, homeless shelters, and schools. Parliamentary elections were held on 27 September 2002, and the Islamist Justice and Development Party (PJD) trebled its seats, coming in third with 42 of 325 parliamentary seats; however, it was denied any ministerial posts in the governing coalition formed by the Socialist Union of Forces for Progress (which took 50 seats) and the nationalist Istiqlal Party (which won 48 seats). The PJD would like to see Islamic law applied nationwide, including a ban on alcohol and a provision to have women wear veils. Morocco's largest and most vocal Islamist organization, Justice and Charity, works outside of the electoral process. Justice and Charity formally rejects the king and the Moroccan constitution, and thus is prevented from participating in organized politics as a party. Justice and Charity's leader instructed his followers to boycott the elections entirely. The group is gaining in popularity; estimates place its membership from between 50,000 and 500,000, and it is especially popular among those under age 30.
Moroccan authorities have begun a crackdown against Islamist groups, including the Salafist Combatants, who have committed crimes in the country. Mosques and bookshops have been closed, and detentions and arrests of Islamists have increased. Critics of the government's actions have stated that the crackdown fails to address problems such as poverty and ignorance, which are causes of radicalism. In June 2002, three Saudis and seven Moroccan nationals, including three women, were arrested and accused of being part of an al-Qaeda plot to plan terrorist acts in Morocco and against Western ships crossing the Strait of Gibraltar.
On 11 July 2002, Moroccan frontier guards planted the national flag on the uninhabited island of Perejil (Leila in Arabic), claimed by Spain. Spain landed troops to "recapture" the island, which Morocco claimed was equivalent to an act of war. The eviction of the Moroccan soldiers took place without any casualties. The United States helped to negotiate a deal to remove all forces from the island. The incident was one of a series of disputes between Spain and Morocco over a number of issues, including fishing rights, illegal immigration by Moroccans to Spain, the Spanish occupation of Ceuta and Melilla on the northern coast of Morocco, and the status of Western Sahara. Full diplomatic ties were reestablished between Spain and Morocco in January 2003.
Regarding Western Sahara, efforts were undertaken in the late 1990s to register voters eligible for a referendum to be held in the region. Morocco stated that approximately 200,000 people were eligible as voters, while Polisario stated only 70,000 people were natives of the territory. In November 2001, King Mohammed VI declared the UN's plan to hold the referendum on Western Sahara "null." Negotiations between the two parties had taken place in 2000 and 2001 under the guidance of former US Secretary of State and current UN envoy to Western Sahara, James Baker, and a "Framework Agreement" was drawn up, that would make Western Sahara an autonomous part of Morocco for a 5-year period, after which a referendum would be held to determine if the region would become independent. Another option would allow for the division of the territory, with one part going to Morocco and the rest becoming an independent Western Saharan state. In January 2003, Polisario rejected a new proposal for the territory put forward by Baker, which did not guarantee enough autonomy for the group to relinquish its demand for a referendum on independence.