Under the command of Uqba ibn Nafi of the Umayyads the first Islamic conquest of North Africa occurred in 670 AD, and their language, system of government and Islam quickly spread to Morocco.
Even after the Arab ruling had diminished, the Berbers slowly continued to convert to Islam, and the first Muslim state, the Kingdom of Nekor, was founded in the Rif Mountains in 710.
About a century after the Arab conquest of North Africa, successive Moorish dynasties began to rule in Morocco, and during the 16th century, the Sa'adi monarchy, particularly under Ahmad Al-Mansur (1578-1603), repelled foreign invaders and inaugurated a golden age.
Moulay Ali Cherif founded the Alaouite Dynasty in 1631, which still remains today as Morocco's current royal family. Ismail Ibn Sharif organized and unified Morocco during his reign from 1672 to 1727.
In 1860, Spain occupied northern Morocco and ushered in a half century of trade rivalry among European powers that saw Morocco's sovereignty steadily erode.
In 1912, the French imposed a protectorate over the country, and under their ruling the natives were denied many freedoms. The children of noble Moroccan families were given a French education, however the rise of this young intellectual class produced a nationalist movement intent on restoring the country to its own people.
A protracted independence struggle with France ended successfully in 1956. The internationalized city of Tangier and most Spanish possessions were turned over to the new country that same year.
Morocco virtually annexed Western Sahara during the late 1970s, but final resolution on the status of the territory remains unresolved.
Upon independence, Morocco restored itself as a constitutional monarchy with an elected parliament.
The king has extensive executive powers and, in addition to various other privileges, can deploy the military and dissolve the government. The current King, Mohammad VI, assumed the throne in July 1999, following the death of his father, King Hassan II, who ruled from 1961 until 1999.
A number of opposition political parties have been formed in the past several years, which are legal.
Arab Spring protests reached Morocco in February 2011, and citizens gathered in Rabat protesting for a new constitution. By July of that same year, King Mohammed VI won a victory on a reformed constitution he initially proposed to appease the protestors.
Demonstrations continued through 2012 by citizens pushing for deeper reforms, and accusing the government of failing to deliver.
Morocco was the first country in North Africa to install a 3G network. Offshore service centers and IT activities, by 2015, will contribute over $500 million to the country's GDP. Morocco is the world's largest exporter of phosphate and the third-largest producer of phosphorous. It currently has a population of 1,655,753.