Military history of Morocco
The military history of Morocco covers a vast time period and complex events. It interacts with multiple military events in a vast area containing North Africa and the Iberian peninsula. The Roman conquests

Just after defeating the Phoenicians and destructing the city of Carthage in nowadays Tunisia during the Punic Wars, the Roman armies took possession of Mauretania and divided it into two provinces. In the west, Mauritania Tingitana was developed by the creation of roads, agricultural innovations and trade expansions. In the mountainous areas, the Berber tribes resisted to the Roman invasions. The Roman influence will be preserved in the south until 285 AD. As of the end of 4th century AD, under the reign of the Roman emperor Diocletian, the Romans maintained nothing but one thin presence on the coast, around Tangier. They remained in the north until 429 AD; date of the passage of the Vandals in this part of Mauretania Tingitana. In 533 AD, the Byzantine fleets and then the Visigoths occupied Ceuta and Essaouira. The Arab conquests

Berber revolt

Territorial expansions

The gallery below shows the maximum extent of each of the prominent dynasties: Almoravid, Almohad, Marinid and the Saadi Sultanate, in addition to the greatest extent of the current dynasty, the Alaouite. Moroccan-Portuguese Wars

The Battle of Alcácer Quibir (also known as "Battle of Three Kings" was a war in northern Morocco, near the town of Kasar El-Kebir and Larache, on 4 August 1578. The battle was between the Moroccan Sultan Abu Abdallah Mohammed II, and his ally, the King of Portugal Sebastian I, against a large Moroccan army nominally under the new Sultan of Morocco (and uncle of Abu Abdallah Mohammed II) Abd Al-Malik I. Over 8,000 Portuguese and Allies were killed and over 15,000 were captured. The defeat of Portugal and death of the childless Sebastian led to the end of Portugal's Aviz dynasty after Spain's Philip II took advantage of the situation and claimed Portugal under familial bonds. The subsequent Iberian Union lasted for 60 years until Portugal regained independence during the Portuguese Restoration War of 1640. Barbary wars

Though Morocco was not part of the Ottoman empire, Moroccan pirates held their activities in both the Mediterranean Sea and the Atlantic ocean. They used two main ports as bases; Salé and Tétouan. Salé pirates roamed the seas as far as the shores of the Americas, bringing back loot and slaves. The character Robinson Crusoe, in Daniel Defoe's novel by the same name, sailed off from the mouth of the Bou Regreg river. In 1783 the United States made peace with and was recognized by Great Britain, and in 1784 the first American ship was captured by pirates from Morocco. The stars and stripes was a new flag to them. After six months of negotiation, a treaty of friendship between the U.S. and Morocco was signed, $60,000 cash was paid, and trade began. Morocco was the first independent nation to recognize the United States back in 1778. Franco-Moroccan Wars

First Franco-Moroccan Wars
The First Franco-Moroccan War consisted of a series of conflicts fought between France and its colonial administrators on one side, and the sultanate of Morocco on the other. The principal cause of war involved the retreat of Algerian resistance leader `Abd al-Qādir into Morocco following French victories over many of his tribal supporters in the French conquest of Algeria. The name of the conflict can be misleading however, seeing the first conflict between the two nations took place during the Larache expedition, after the Seven Years' War. Second Franco-Moroccan Wars
The Second Franco-Moroccan War took place in 1911, when Moroccan forces besieged the French-occupied city of Fez. Approximately one month later, French forces brought the siege to an end. On March 30, 1912, Sultan AbdelHafid signed the Treaty of Fez, formally ceding Moroccan sovereignty to France, which established a protectorate. On April 17, 1912, Moroccan infantrymen mutinied in the French garrison in Fez. The Moroccans were unable to take the city and were defeated by a French relief force. In late May 1912, Moroccan forces unsuccessfully attacked the enhanced French garrison at Fez. Spanish-Moroccan war

Resistance against colonialism

Zaian War

The Rif wars

Ifni War

Use of Moroccan recruits by the colonial forces

During the period of the French protectorate of Morocco (1912–1956) large numbers of Moroccans were recruited for service in the Spahi and Tirailleur regiments of the French Army of Africa. During World War II more than 300,000 Moroccan troops (including goumier auxiliaries) served with the Free French forces in North Africa, Italy, France and Austria. The two world conflicts saw Moroccan units earning the nickname of "Todesschwalben" (death swallows) by German soldiers as they showed particular toughness on the battlefield . By the end of the World War II, Moroccan troops took part of the French Expeditionary Force engaged in the First Indochina War from 1946 to 1954. The Spanish Army also made extensive use of Moroccan troops recruited in the Spanish Protectorate, during both the Rif War of 1921-26 and the Spanish Civil War of 1936-39. Moroccan Regulares, together with the Spanish Legion, made up Spain's elite Spanish Army of Africa. A para-military gendarmerie, known as the "Mehal-la Jalifianas" and modelled on the French goumieres, was employed within the Spanish Zone. The Sand War

Before the French colonization in the 19th century, parts of southern and western Algeria belonged to Morocco. In the 1930s and later in the 1950s, France had integrated into what was known as the Overseas Département of French Algeria, the areas of Tindouf and Bechar. When Morocco gained independence in 1956, it wanted to reassert sovereignty over these areas. In an effort to cut the support that the Front de Libération Nationale (FLN) was getting from Morocco, France offered to return those areas in exchange for Morocco stopping that support. King Mohammed V refused to make a deal with France behind the back of the "Algerian brothers", and agreed with the Algerian provisional government's nationalist leader Ferhat Abbas, that once Algeria gained its independence it would renegotiate the status of the Tindouf and Bechar areas. However, immediately after Algeria's independence, and before his agreement with the Moroccan King Muhammad V could be formally ratified, the first Algerian provisional president Ferhat Abbas was purged from the FLN government by a military-backed coalition led by the first Algerian provisional president Ahmad Ben Bella. Ben Bella reneged on the deal that Ferhat Abbas agreed to. Skirmishes along the border eventually escalated into a full-blown confrontation after Algerian troops attacked and killed 10 Moroccans soldiers in a town near Figuig. The Algerian army, just formed from the guerrilla ranks of the FLN's Armé de Libération Nationale (ALN) was still geared towards asymmetric warfare, and had little high-powered equipment . They were still battle-ready and held tens of thousands of experienced veterans, and strengthening the armed forces had been a top priority for the military-dominated post-war government. On the other hand, while being modern, western-equipped Moroccan army was superior on the battlefield, it did not manage to penetrate into Algeria. The war stalemated with the intervention of the Organization of African Unity (OAU) and the Arab league and it was broken off after approximately three weeks. The OAU eventually managed to arrange a formal cease-fire on February 20, 1964. A peace agreement was then made after Arab League mediation, and a demilitarized zone instituted but hostilities simmered. 1967 and Yom Kippur Wars
The 1973 Yom Kippur War was the fourth major conflict between Israel and the neighboring Arab States. Like many other Arab States, Morocco contributed by deploying 5,500 troops, 30 tanks and 52 combat aircraft  to take part in the Yom Kippur War. Morocco sent one infantry brigade to Egypt and one armored regiment to Syria. [433][443] 6 Moroccan troops were taken prisoner in the war. The Western Sahara conflict

See also
 History of Morocco
 Military history of Africa

References and notes