Pre-Arab Flags (before 8th Century)

The first inhabitants of Morocco were nomadic Berber tribes. The Phoenicians established counters on the coast around the 12th century BC and founded Carthage (now in Tunisia). The Romans destroyed Carthage in 146 BC, but the romanisation of Morocco remained very weak. In 429, the Vandals from Spain invaded Morocco, which was eventually incorporated to the Byzantine Empire by Justinian in 534.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

Early Arab Flags (8th to 9th Century)

In the beginning of the 8th century, the Arab chief Musa bin Nosayr seized Tangiers, established a governor in the city, and introduced Islam on Morocco. The Berbers were converted to Islam but revolted in 740 and founded independant principalities in the Rif mountains. Princes Idris I (d. 791) and Idris II (d. 828) ruled all the Berber tribes and spread Sunni Islam among them. The Idrisids (789-985) founded the
city of Fes, which was their religious, political and economical capital city. However, the Idrisid power declined after Idris II’s death and Morocco was disputed between the Fatimids of Ifrikiya (now Tunisia and eastern Algeria) and the Spanish Umayyads during the Xth century.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

White Flags (9th to 17th Century)

In 1062, the Almoravid Berbers from Upper-Atlas mountains invaded the plains of southern Morocco. The Almoravids (from Al-Mourabitoun, “the peoples of the ribat”, a ribat being a military monastery) brotherhood was founded by Sheik Abdallah Ibn Yasin and its first ruler was Yusuf Ibn Tashfin, who founded the city of Marrakesh in 1062. The Almoravids ruled over northern Africa and Andalusia from 1061 to 1147. Initially, they imposed a very strict Islam, but they progressively relaxed their discipline.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

The use of the flag in Morocco as a symbol of the state dates way back to the Almoravide dynasty (1062-1125 AD). Prior to this time, white silk banners were often carried in battle,sometimes with Koranic inscriptions written on them. The Almoravides institutionalized this practice. They gave one banner to every unit of 100 soldiers; the leaders always carried one inscribed: «There is no god but god, and Mohammad is His Prophet». The two following dynasties (the Merinides and the Saadiens) continued the use of the White flag as the symbol of the State.
Dov Gutterman, 17 Apr 1999,

The Almohad Berbers from Upper-Atlas fought the Almoravids in the name of orthodoxy. The Almohads (Al-Muhawidun, "partisans of the divine unity") were ruled by Ibn Tumart and later by Abd-al-Mumin. They conquered all northern Africa and Almoravid Spain, where they ruled from 1147 to 1269.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

The Zanata Berbers from the Banu Marin tribe revolted and founded a dynasty which ruled from 1269 to 1465, claiming to be the Almohads’ heirs. They reused on their banners the two interlaced squares cherished by the Almohads. This emblem was used in Morocco until the 20th century.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

The Banu Watta Berbers expelled the Marinids and ruled from 1470 to 1554. The Portuguese seized Ceuta in 1415 and Tangiers in 1471, whereas the
Catholic Kings of Aragon and Castile seized Granada in 1492. The Sa’adid chorfa (plural of "cherif", descendants of Fatima, the Prophet’s
daughter, or of Hasan, the Prophet’s son) took the power and attempted to expell the Christian invaders. In 1578, they defeated the Portuguese army led by King Dom Sebastião in Alcazar Kibir.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

Red flags (17th to 21st Century)

The flag of Morocco was originally plain red, despite the numerous fanciful designs attributed to the country by european flag chart publishers.
Jorge Candeias, 23 Aug 1999, quoting from Crampton 1990

After a troubled period, Mulay-al-Rashid subjugated the Berbers of Atlas and the whole of Morocco. He was the son of the founder of the Alawiyya dynasty (Hassanid chiefs) and descendant of the Prophet. The Hassanid reformed the country and established commerce treaties with Sweden, England, France and
Denmark.
The Alawits have been ruling Morocco since 1666.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

The Alawites (beginning in the 17th Century), which are the ruling dynasties and the ancestors of His Majesty King Hassan II, were the first to introduce the red flag. It was raised every morning and lowered every evening on the fortresses at Rabat and Sale. The green Sulayman star on the flag was introduced in 1912, when Morocco was put under the French protectorate, in order to distinguish the nation’s flag from the others.

Dov Gutterman, 17 Apr 1999,

In the end of the 19th century, there were a lot of revolts in Morocco and the European powers decided to solve the “Moroccan problem”. France occupied Ujda and Casablanca in 1907, whereas Spain occupied Salwan and other strategic places in 1909. In spite of German protest, the French Protectorate over Morocco was established on 30 March 1912. The Sultan kept a nominal sovereignty. The Spanish zone was completely autonomous (treaty from 27 November 1912). During the "pacification" campaigns, the war flags captured to Moroccan tribes were based on the Marinid emblem, a red field with two yellow interlaced squares forming a star.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

Chequered Flags (11th-13th Century)

Square Version

image by Ivan Sache, 15 Jun 2003

The oldest known flag of Morocco is shown in the Libro de Conoscimiento de Todos los Reynos. This flag is supposed to have been used by the rulers in Morocco in 11th-13th
century. The flag is red with a 64-square chessboard placed in the middle of the flag. The upper left square of the chessboard is white. Red might refer to the Fatimids, white to the Umayyads and black to the Abbasids, who had established a protectorate over Kairuan and Fes.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

Round Version

image by Ivan Sache, 15 Jun 2003

That is not the flag of the Kingdom of Morocco, it is the flag of the city of Marrakech.
Jaume Ollé, 9 Oct 1998

I believe it is very difficult to ascertain the identity of those flags, which are probably variant or erroneous copies of a single archetypal flag.
Ivan Sache, 15 Jun 2003

Version with Schwenkel

image by Klaus-Michael Schneider, 8 Nov 2008

It is a red squarish flag with a triangle - according to German terms a "Schwenkel" - of double width at the upper edge. In the centre of the flag is an oval chequered dark blue and white.
Neubecker mentions, that is was practice to draw flags into 14th and 15th century portolanos (=maps) , with a pattern, which was a simple repetition of the pattern of the coat of arms. French and English books about ships contained images to support the above hypothesis.
Source: Neubecker 1939; p.63
Klaus-Michael Schneider, 8 Nov 2008

In neu39a, captioned «Marokko 1367» a squarish red flag with a swallowtail at the top only. In the center is a circle of blue/white checkerboard.
John Niggley, 25 Jan 1996

"Marokko 1367", the date being probably that of a portolano showing that flag. The statement within Neubecker 1939 leaves little doubt as to the reliability of medieval portolanos as a flag:
"Flags in the pattern of attributed arms were straightaway assigned even to exotic lands whose flags were certainly unknown, as e.g. Marocco."
Santiago Dotor, 18 Jun 2003

Version in Siegel's Book

image by Klaus-Michael Schneider, 7 Oct 2008
It is a red ogival pennant with a four times four white and black chess board in its centre. Some similar flags are already in our pages, this one has only 4x4 squares.
Source: Siegel 1912; flagchart 17; row 4; column 1 based upon Conocimiento de todos los reinosKlaus-Michael Schneider,7 Oct 2008

Version in Catalan Atlas

image by Tomislav Todorović, 25 Jun 2010
In the Catalan Atlas [1, 2], the flag flying above the city of Marrakech (spelled Maroch) has a chequered disc, divided into sixteen white and black fields, on the red field. Its form is rectangular, with the fly ending in form of a rounded point with concave top and bottom edges. The flag is shown with the sinister hoist. Considering the "Book of All Kingdoms" [3], where the earliest version of this design was shown, this might be the flag of Marrakech only, because this source also shows the flag of Fez. However, there is no flag of Fez in the Catalan Atlas, not in many other portolanos either [1], so it was probably used there to represent the whole country of Morocco.
Sources:
[1] Donald Wigal: "Historic maritime maps used for historic exploration 1290-1699", Parkstone Press, New York, USA, 2000; ISBN 1-85995-750-1
[2] "Enciclopedia universal ilustrada ", vol. XXI, España Madrid: Espasa-Calpe S.A., 1968
[3] "Libro del Conoscimiento. Viajes medievales ", vol. I, Madrid: Fundación José Antonio de Castro, 2005; ISBN 84-96452-11-5 (complete edition); ISBN 84-96452-12-3 (vol. I)
Tomislav Todorović, 25 Jun 2010

The so-called Charles V’s Atlasshows a similar flag, which ended with a triangle and has a circular chessboard placed in the middle.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

This flag can be found on several old flag charts.
Jarig Bakker, 21 Aug 1999

Morocco had around 1884 a red flag, with a border of red and white triangles, in the center two white scimitars crossed.
Josh Fruhlinger, 11 May 1996

image by Klaus-Michael Schneider, 16 Apr 2014

Norie & Hobbs 1848 shows as flag #250, captioned «Emperor of Morocco», with slightly more triangles and in black details in the "scissors": an eye in each handle, and a circle and a pin in the circle in the centre. Bellin 1756, as shown in Sierksma 1963, has nearly double the triangles, and open eyes. (triangles: 2 x 11 horizontally and 2 x 7 vertically)
Peter Hans van den Muijzenberg, 21 Jan 1999

On this chart Bellin 1756, the flag is labelled "Morocco" and consists of a red field with a border made of red and white triangles and with white open scissors centered. Thus, the Moroccoan flag should then be a red flag with the zul-faqar centered and a red/white border of triangles, all these elements white.
Jorge Candeias, 21 Aug 1999

with Simple Orle

image by Ivan Sache, 15 Jun 2003

The Piemontese Chronicles report that, in 1781, a vessel flying a red flag "with two white scissors" moored in the port of Villafranca (now Villefranche-sur-Mer, in France). The vessel came from "the Sultanate of Morocco". Lux-Wurm 2001 says that these "scissors" were in fact two misinterpreted sabers. But he himself fails to interpret these sabers as the famous zulfiqar.
Ivan Sache, 15 Jun 2003

The dhu-ul-fiqr or thul fuqar or zul-faqar or zulfikar (or any of a number of transliterations from the Arabic) has been used as a symbol of Morocco because the ruling Alawite dynasty claims legitimacy by virtue of descent from the Prophet’s son-in-law, Ali. Dhu-ul-fiqr (i.e. "bifurcated") was Ali’s sword, the blade of which was split in half. This two-blade or bifurcated sword in Arabic is called "kilij".
Joseph McMillan, 21 Aug 1999

Battle Flags with Marinid Emblem (18th- 20th Century)

image by Ivan Sache, 15 Jun 2003

During the "pacification" campaigns in the early 20th century, French and Spanish troops captured war flags from Moroccan tribes; these were based on the Marinid emblem, a red field with two yellow interlaced squares forming a star.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

On 16 April 1908 on Menaba, Lieutenant-Colonel Perron captured a 2:3 flag based on the Marinid pattern, with a yellow crescent placed in each angle of the flag. On 6 September 1912, General Mangin captured in Sidi Bu Othman a similar flag, with a small crescent and full moon iside the Marinid emblem. Those two flags are kept in the Army Museum in Paris.
Ivan Sache, 15 Jun 2003, based on [Lux-Wurm 2001]

image by ,

image by ,

Are the flags shown within this photo those, you had referred to in message above?
Klaus-Michael Schneider, 20 Apr 2014

Not those, but they are clearly related. The flags I referred to are kept inside the Army Museum (Hôtel des Invalides), while the photo shows flags hanging from the vault of the nearby church of Saint-Louis-des-Invalides.
Ivan Sache, 21 Apr 2014

The referred eight pointed blue star seems to be the symbol "Star of Rub el Hizb", found in Unicode under
U+06DE. It is an 8-pointed star consisting of two crossed squares. This is an islamic sign and is found in other emblem and flags. For instance: