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.
The Kingdom of Morocco
Population 35 million
Area 710,850 sq km (274,461 sq miles) (including W Sahara)
Major languages Arabic and Berber (official), French, Spanish
Major religion Islam
Life expectancy 74 years (men), 77 years (women)
King: Mohammed VI
Groomed for "kingship", as his late father King Hassan II referred to his upbringing, Mohammed VI became monarch 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.
In early 2018 the king had successful heart surgery in France.
Prime minister: Saad-Eddine El Othmani
Saad-Eddine El Othmani was appointed prime minister in March 2017 and asked to form a government by King Mohammed.
A psychiatrist, Mr El Othmani was the Justice and Development Party's secretary-general between 2004 and 2008, and the foreign minister in Abdelilah Benkirane's first government between 2012 and 2013.
He replaces Benkirane, who was dismissed by the king after failing to form a coalition government in the months following the 2016 elections.
Benkirane had proposed rebuilding his outgoing coalition, but faced opposition from Aziz Akhannouch, a close ally of King Mohammed, and the resulting power struggle led to a political impasse.
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.
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 from local Saharawi people.
1998 - Morocco's first opposition-led government comes to power.
1999 - King Hassan II is succeeded by his son, Mohammed VI.