Morocco was the first nation, in 1777, to recognize the U.S. as an independent nation. The Treaty of Peace and Friendship between the U.S. and Morocco, negotiated in 1787, is the longest unbroken treaty relationship in U.S. history.
The history of Morocco spans over twelve centuries. Morocco had a thousand year tradition of independence. The circumstances and proximity of Morocco to Spain created a special relationship between the two countries.
The Alaouite dynasty distinguished itself in the 18th and 19th centuries by maintaining Morocco's independence while other states succumbed to Turkish, French or British domination. However, in the latter part of the 19th century Morocco's weakness and instability invited European intervention to protect threatened investments and to demand economic concessions. The first years of the 20th century witnessed a rush of diplomatic maneuvering through which the European powers and France in particular furthered their interests in North Africa. Disputes over Moroccan sovereignty were links in the chain of events that led to World War I.
The Treaty of Fez was signed March 30th, 1912. Sultan Abdelhafid gave up the sovereignty of Morocco to the French, making the country a protectorate.