A chronology of key events:
7th and 8th Centuries AD - Arab invasion; Idris founds the first major Muslim dynasty.
10-17th Centuries - Dynasties and religious movements come and go, including the Almoravid movement which at its peak controlled Morocco and parts of present-day Algeria and Spain.
1860 - Dispute over Spain's Ceuta enclave; Spain declares war, wins a further enclave and an enlarged Ceuta in the settlement.
1884 - Spain creates a protectorate in coastal areas of Morocco.
1904 - France and Spain carve out zones of influence.
1906 - Algeciras Conference in Spain; France and Spain get the go-ahead to police Moroccan ports and collect customs fees.
1912 - Morocco becomes a French protectorate under the Treaty of Fez, administered by a French Resident-General. Spain continues to operate its coastal protectorate. The sultan has a largely figurehead role.
1921-6 - Tribal rebellion in Rif mountains is suppressed by French and Spanish troops.
1943 - Istiqlal - Party of Independence - founded to press for independence.
1956 March - End of French protectorate after unrest and strong nationalist sentiment. Spain keeps its two coastal enclaves. Sultan Mohammed becomes king in 1957.
1961 - Death of King Mohammed; King Hassan II comes to power.
1963 - First general elections.
1965 - Social unrest: King Hassan declares a state of emergency and suspends parliament.
1971 - Failed attempt to depose king and establish republic.
1973 - Polisario movement formed, aims to establish an independent state in Spanish Sahara, a territory south of Morocco controlled by Spain. The group has Algerian support.
1975 6 November - The Green March: King Hassan orders 350,000 civilian volunteers to cross into Spanish Sahara.
1975 December - Spain agrees to leave Spanish Sahara, soon to become Western Sahara, and to transfer it to joint Moroccan-Mauritanian control. Algeria objects and threatens military intervention. Moroccan forces enter and occupy the territory.
1976 - Moroccan and Algerian troops clash in Western Sahara. Algeria announces the formation of the Saharawi Arab Democratic Republic (SADR) with a government-in-exile. Morocco and Mauritania divide-up Western Sahara.
1976 onwards - Fighting between Moroccan military and Polisario forces; the war is a considerable financial drain on Morocco.
1983 - Summit between King Hassan and Algerian president prompts thaw in relations.
1983 - King cancels planned elections amid political unrest and economic crisis.
1984 - Morocco leaves the Organisation of African Unity in protest at the SADR's admission to the body. Polisario claims to have killed more than 5,000 Moroccan soldiers between 1982-85.
1988 - Resumption of full diplomatic relations with Algeria.
1991 - UN-monitored ceasefire begins in Western Sahara, but the territory's status remains undecided and ceasefire violations are reported. The following decade sees much wrangling over a proposed referendum on the future of the territory but the deadlock is not broken.
1998 - Morocco's first opposition-led government comes to power.
1999 - King Hassan II is succeeded by his son, Mohammed VI.
2001 November - King Mohammed starts a controversial tour of Western Sahara, the first by a Moroccan monarch for a decade.
2002 July - Morocco and Spain agree to US-brokered resolution over the disputed island of Perejil. Spanish troops had taken the normally-uninhabited island after Moroccan soldiers landed on it and set up tents and a flag.
2002 December - Morocco and Spain hold their first talks since their conflict over Perejil. In January 2003 they agree to return ambassadors.
2003 February - Casablanca court jails three Saudi members of al-Qaeda for 10 years after they were accused of plotting to attack US and British warships in the Straits of Gibraltar.
2003 May - More than 40 killed when suicide bombers attack several sites in Casablanca, including a Spanish restaurant and Jewish community centre.
2004 February - Powerful earthquake hits the north; more than 500 people are killed.
2004 July - Free trade agreement with the US comes into effect. It follows Washington's designation of Morocco as a major non-Nato ally.
2005 September-October - Hundreds of African migrants try to storm Morocco's borders with the Spanish enclaves of Melilla and Ceuta. Morocco deports hundreds of the illegal migrants.
2005 December - Truth commission investigating human rights abuses during the rule of King Hassan II says 592 people were killed between 1956-99.
2006 January - Spanish Premier Zapatero visits the Spanish enclaves of Melilla and Ceuta. He's the first Spanish leader in 25 years to make an official visit to the territories.
2007 April - Three suspected suicide bombers blow themselves up in Casablanca, a few weeks after a suicide blast in an internet cafe weeks earlier.
Two suicide bombers blow themselves up outside US diplomatic offices in Casablanca.
Morocco unveils an autonomy blueprint for Western Sahara to the United Nations. Independence movement Polisario rejects the plan and puts forwards its own proposal.
2007 June - Morocco and the Polisario Front hold UN-sponsored talks in New York but fail to come to any agreement.
2007 September - Parliamentary elections. The conservative Istiqlal party, a member of the ruling coalition, wins the most votes.
2007 November - Spanish King Juan Carlos visits Ceuta and Melilla, angering Morocco which demands the return of the enclaves.
Moves against militants
2008 April - Spanish police arrest two Moroccans wanted over 2003 Casablanca bombings, plan extradition.
2008 September - Fouad Ali al-Himma, a confidant of King Mohammed, forms an alliance around his new Authenticity and Modernity Party. The party has the potential to dominate parliament.
Court sentences more than 40 people to long prison sentences over Casablanca internet cafe suicide bombing that injured three.
2008 December - Two Moroccan men, Abdelilah Ahriz and Hicham Ahmidan, sentenced to 20 and 10 years in jail respectively in Morocco over Madrid train bombings of 2004.
2009 February - Islamist Saad Housseini given 15-year sentence over 2003 Casablanca bombings that killed 45 people. Also wanted in Spain over Madrid bombings.
2009 July - Alleged al-Qaeda leader in Morocco, Belgian-Moroccan Abdelkader Belliraj, imprisoned for life on being found guilty of leading an Islamist militant group and committing six murders in Belgium.
2010 November - Security forces storm a protest camp in disputed territory of Western Sahara, triggering violent demonstrations in regional capital Elayoun.
"Arab Spring" protests
2011 February - Thousands of people rally in Rabat and other cities calling for political reform and a new constitution curbing the powers of the king.
2011 April - 17 people - mainly foreigners - are killed in a bomb attack on a Marrakech cafe. It is Morocco's deadliest blast in eight years. The Maghreb arm of al-Qaeda denies involvement.
2011 July - King Mohammed scores a landslide victory in a referendum on a reformed constitution he proposed to placate "Arab Spring" protests. Demonstrators continue to call for deeper reforms.
2011 October - Court sentences man to death for bombing of tourist cafe in Marrakech in April.
2011 November - Parliamentary elections won by moderate Islamist Justice and Development Party (PJD).
2012 January - New coalition headed by PJD leader Abdelilah Benkirane is installed.
2012 May - Tens of thousands take part in Casablanca trade union rally, the largest since the new government took office in January. Participants accuse Prime Minister Benkirane of failing to deliver on reforms.
2013 January - Government backs changing penal code article that allows rapists of underage girls to avoid prosecution by marrying their victims. Follows suicide of 16-year-old girl forced to marry her rapist.
2013 April - Morocco cancels joint military exercises with the US over Washington's backing for UN monitoring of human rights in Western Sahara. Morocco calls the proposed monitoring an attack on its sovereignty.
2013 October - King appoints new government following a power-sharing deal forged by Prime Minister Abdelila Benkirane months after his governing coalition was hit by the resignation of one of its partners.
2013 September - News site editor Ali Anouzla arrested for publishing a video which was attributed to Al-Qaeda in the Islamic Maghreb and which accused the king of being corrupt and oppressive.
2014 February - Morocco suspends judicial co-operation with France following a diplomatic row over lawsuits in Paris that accuse the kingdom's intelligence chief Abdellatif Hammouchi of complicity in torture.
2014 May - Spain says a thousand migrants tried to enter the Spanish territory of Melilla, in North Africa, from Morocco.
The UN High Commissioner for Human Rights during a visit urges Morocco to do more to improve its human rights record.
2014 October - Morocco summons the Algerian ambassador after a shooting incident at the border. The borders between Morocco and Algeria have been closed since 1994, and relations have remained tense because of the longstanding dispute over the territory of Western Sahara.
2014 November - Morocco is disqualified from the 2015 African Cup of Nations after refusing to host the tournament over concerns about the spread of ebola.
2015 March - Government says security services dismantle network of militants linked to Islamic State group.
2015 February - Authorities destroy makeshift migrant camps near the Spanish enclave of Melilla, after hundreds storm the border fence trying to reach Europe.
2016 March - Morocco expels more than 80 UN staff in Western Sahara, reacting angrily to UN Secretary-General Ban Ki-moon's use of the word "occupation" to describe Rabat's 1975 annexation of the area.
2016 October - Parliamentary elections. King picks Abdelilah Benkirane for a second term as prime minister after his party wins the most seats.
2016 October-November - Large-scale protests after a fish seller in al-Hoceima was crushed to death in a rubbish truck as he tried to retrieve fish confiscated by police.
2017 March - King Mohammed dismisses Abdelilah Benkirane from his post as prime minister, due to his failure to form a coalition government. King chooses former PDJ secretary-general Saad-Eddine El Othmani as his successor.
2017 May - New wave of demonstrations in al-Hoceima over long-standing economic grievances.