The French conquest of Morocco began in 1907 and continued until 1934.
Before the Protectorate
The French trans-Saharan railroad, reaching Aïn Séfra by 1897, redirected the economic ties of Figuig from Fes to Oran. From 1900, French troops drove into the region. The conquest of the oasis of Tuat led to the redrawing of the Algeria–Morocco border in 1901, and the lobby of French settlers in Algeria pressed the French government in Paris to colonize this region to link Algeria with Senegal. Under the command of Officer Hubert Lyautey, the French took Béchar in 1903, which Lyautey renamed "Colomb" to conceal its location from leadership in Paris. Following an attack on Governor-General of AlgeriaCharles Jonnart, French forces bombarded Qsar Zenaga in Figuig, which Le Petit Parisien described as a show of force "to demonstrate to the Moroccans the power and range of our cannons." With the 1904 Entente Cordiale, the British Empire withdrew its support for the neutrality and independence of Morocco, and the 1906 Algeciras Conference formalized French preëminence in Morocco.
Particularly after the Madrid Conference of 1880, the press in Morocco became a colonial battleground. From 1904, the French Legation in Tangier published Es-Saada, a daily arabophone newspaper to promote French interests and influence Morocccan public opinion, taking aim especially at Sufi resistance leaders such as Muhammad b. al-Kabir al-Kattani and Ma al-'Aynayn. oasis in 1903.
In March 1907, French troops occupied Oujda after the assassination of Émile Mauchamp in Marrakesh.
Bombardment of Casablanca
A western front was opened in August 1907 with the bombardment of Casablanca in the west. French forces then pushed into the Shawiya plain in what French historians call the pacification de la Chaouia.
Eastern Campaign
By 1911, the French campaign from the east, through what is now the southwest of Algeria, had reached the Ziz River, 200 miles within the Moroccan border. This effectively put a large swath of the pre-Saharan area in the southeast of Morocco under French control.
On 21 May 1911, France occupied the city of Fes at the behest of SultanAbd al-Hafid, which led to the Agadir Crisis. On 30 March 1912, Sultan Abd al-Hafid signed the Treaty of Fes, formally ceding Moroccan sovereignty to France, transforming Morocco into a protectorate of France and sparking the 1912 Fez riots. Although, the Sultan and the Makhzen had consented to the treaty, many regions remained in revolt until 1934, when Morocco was declared pacified. In several regions, French authority was maintained by cooperation with local chiefs and not by military strength.
Fes Intifada
On 17 April 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. The last resistance to the conquest of Morocco occurred in 1933–34. The conquest of Morocco took over 22 years.
The Zaian confederation of Berber tribes in Morocco fought a war of opposition against the French between 1914 and 1921. Resident-GeneralLouis-Hubert Lyautey sought to extend French influence eastwards through the Middle Atlas mountains towards French Algeria. This was opposed by the Zaians, led by Mouha ou Hammou Zayani. The war began well for the French, who quickly took the key towns of Taza and Khénifra. Despite the loss of their base at Khénifra, the Zaians inflicted heavy losses on the French. With the outbreak of the First World War, France withdrew troops for service in Europe, and they lost more than 600 in the Battle of El Herri. Over the following four years, the French retained most of their territory despite the Central Powers' intelligence and financial support to the Zaian Confederation and continual raids and skirmishes reducing scarce French manpower. After the signing of the Armistice with Germany in November 1918, significant forces of tribesmen remained opposed to French rule. The French resumed their offensive in the Khénifra area in 1920, establishing a series of blockhouses to limit the Zaians' freedom of movement. They opened negotiations with Hammou's sons, persuading three of them, along with many of their followers, to submit to French rule. A split in the Zaian Confederation between those who supported submission and those still opposed led to infighting and the death of Hammou in Spring 1921. The French responded with a strong, three-pronged attack into the Middle Atlas that pacified the area. Some tribesmen, led by Moha ou Said, fled to the High Atlas and continued a guerrilla war against the French well into the 1930s.
Rif War
's reign, from 1912 to 1927, was turbulent and marked with frequent uprisings against Spain and France. The most serious of these was a Berber uprising in the Rif Mountains, led by Abd el-Krim, who managed to establish a republic in the Rif. Though this rebellion began in the Spanish-controlled area in the north, it reached the French-controlled area. A coalition of France and Spain finally defeated the rebels in 1925. To ensure their own safety, the French moved the court from Fez to Rabat, which has served as the capital ever since.