The Treaty of Fez (Arabic: معاهدة فاس) was a treaty signed on 30 March 1912 in which Sultan Abdelhafid agreed to allow France to make Morocco a French protectorate, ending the Agadir Crisis of 1 July 1911.
Germany recognised the French protectorate in Morocco, receiving in return territories in the French Equatorial African colony of Middle Congo (now the Republic of the Congo). This land, known as Neukamerun, became part of the German colony of Kamerun, part of German West Africa, although it only lasted briefly until it was captured by the Allies in World War I. As part of the treaty, Germany ceded France a small area of territory to the south-east of Fort Lamy, now part of Chad.
France gained authority over non-Moroccan citizens in legislative, military, foreign policy and jurisdictional transactions. According to the treaty, this left the Moroccan government in control of its own citizens. Moroccan nationalists dispute this, noting that France still influenced Moroccan affairs as a result of the treaty.
Spain also gained a zone of influence in Northern Morocco which became Spanish Morocco. By the agreement signed with France and Spain in November that year, Spain gained a zone of influence in the Rif and the Cape Juby areas, where the Sultan remained nominally the sovereign and was represented by a vice regent under the control of the Spanish high commission.
Private agreements among the United Kingdom, Italy and France in 1904, collectively known as the Entente Cordiale, made without consulting the sultan, had divided the Maghreb into spheres of influence, with France given Morocco. In Morocco, the young Sultan Abdelaziz acceded in 1894 at the age of ten, and Europeans became the main advisers at the court, while local rulers became more and more independent from the sultan. The Sultan was deposed in 1908. Moroccan law and order continued to deteriorate under his successor, Abdelhafid, who abdicated in favour of his brother Yusef after signing the Treaty of Fez.
The Treaty of Fez granted the concession for exploitation of the iron mines of Mount Uixan to the Spanish Rif Mines Company, which was also given permission to build a railroad to connect the mines with Melilla.
The treaty was perceived as a betrayal by Moroccan nationalists and led to the 1912 Fez riots and the War of the Rif (1919–26) between the Spanish and the Moroccan Riffians and the Jebala tribes. Their leader became Abd el-Krim, who, after driving back the Spanish, founded a short-lived state, the Republic of the Rif.