In 1900 France and Italy made an agreement which gave France control of Morocco, and Italy control of Libya. In 1902, France made an agreement with Spain, which divided Moroccan territory between the two, and in 1904, the French and British strike a deal which gave France free reign over Morocco, as long as they did not fortify Gibraltar, giving Britain a clearer role in Egypt. While all of these pacts are made among countries, Morocco still has their own government ruled by the Alaouite dynasty of sultans, who had been ruling since 1666. In 1905, German emperor William II visits Tangier, and makes it very clear that Morocco must remain an independent country. Shortly after in 1906, a conference was held between European powers and US President Teddy Roosevelt in Algeciras. Austria-Hungary was the only power who sided with Germany, and the rest remained loyal to France. The end result was the declaration of Morocco as a French colony.
French troops were increased as tensions rose. In 1911 Germans sent a gunboat to Agadir. France in turn ceded territory to Cameroon- a German colony. This move for peace gave France Germany’s approval of their role in Morocco.
The Treaty of Fes is signed in 1912 by the sultan, which grants the French protectorate over all of Morocco. France in turn is able to give some control to the Spanish to avoid conflict along the Mediterranean. Spain becomes the colonial power for 1/10 of Morocco, mainly land lying in the North. This treaty creates a large divide among Morocco, as the two respective parts are linked more to their European powerhouses than each other.