The Kingdom of Morocco is the most westerly of the North African countries known as the Maghreb - the "Arab West". It has Atlantic and Mediterranean coastlines, a rugged mountain interior and a history of independence not shared by its neighbours.
Its rich culture is a blend of Arab, Berber, European and African influences.
Morocco was a French protectorate from 1912 to 1956, when Sultan Mohammed became king. He was succeeded in 1961 by his son, Hassan II, who ruled for 38 years and played a prominent role in the search for peace in the Middle East. He also ruthlessly suppressed domestic opposition.
King: Mohammed VI
Mohammed VI became king in 1999. He initiated political and economic changes and an investigation into human rights abuses during his father's rule.
A key reform was the Mudawana, a law which grants more rights to women. The king has said it is in line with Koranic principles, but religious conservatives have opposed it.
Following pressure for reform inspired by the "Arab Spring" of 2010, a new constitution was introduced, expanding the powers of parliament and the prime minister, but leaving the king with broad authority over all branches of government.
Prime minister: Aziz Akhannouch
The liberal National Rally of Independents party led by oil and gas billionaire Aziz Akhannouch narrowly won the September 2021 election, ousting the conservative Islamist PDJ party that had led governments for a decade.
Moroccan political analysts said a flagging economy undermined support for the PDJ.Mr Akhannouch held office in PDJ-led coalitions as agriculture minister from 2007 until he took over as prime minister.
The broadcast media are either dominated by the state or reflect the official line. However, the private press has succeeded in breaking taboos over some sensitive topics, including allegations of high-level corruption.
Paris-based Reporters Without Borders notes that "religion, the king and the monarchy in general, the country and territorial integrity cannot be questioned."
The government owns, or has a stake in, RTM and 2M, Morocco's main TV networks. Satellite dishes are widely used, giving access to French and pan-Arab stations.
Read full media profile
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.
1904 - France and Spain carve out zones of influence.
1912 - Morocco becomes a French protectorate under the Treaty of Fez.
1956 - 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.
1975-76 - Morocco annexes Western Sahara, but faces an ongoing guerrilla battle for independence.
1998 - Morocco's first opposition-led government comes to power.
1999 - King Hassan II is succeeded by his son, Mohammed VI.