Relations between the Kingdom of Morocco and the United States of America date back to the American Revolutionary War (1775–1783) and specifically since 1777 when Morocco under Sultan Mohammed ben Abdallah became the first country in the world to recognize the independence of the United States. Morocco remains one of America's oldest and closest allies in North Africa and in the Arab world, a status affirmed by Morocco's zero-tolerance policy towards Al-Qaeda and their affiliated groups. Morocco also assisted the U.S. Central Intelligence Agency with questioning Al-Qaeda members captured in Afghanistan, Iraq, and elsewhere during the administration of President George W. Bush, who designated the country as a major non-NATO ally.

Formal U.S. diplomatic relations with Morocco began in 1787 when the Confederation Congress ratified a Treaty of Peace and Friendship between the two nations, which had been signed earlier in 1786. Although the Sultan of Morocco declared war on the United States in 1802,Letter from James Simpson to James Madison the treaty was renegotiated in 1836 and is still in force, making it the longest unbroken treaty relationship in the history of the United States. Tangier is home to the oldest U.S. diplomatic property in the world. Now a museum, the Tangier American Legation Museum is also the only building outside of the U.S. that is designated as a National Historic LandmarkExcluding those in the Compact of Free Association. and the only foreign building to be listed on the National Register of Historic Places.Excluding those in the Compact of Free Association.

The U.S. maintains an embassy in Rabat, Morocco. Morocco maintains an embassy in the United States at 1601 21st Street N.W., Washington, D.C. 2009.

History

1777–1787

On 20 December 1777, Sultan Mohammed ben Abdallah commissioned the Dutch consul in Salé to write letters to European merchants and consuls in Tangier, Salé, Larache and Mogador stating that vessels sailing under the American flag could enter Morocco's ports, alongside those of European countries with which Morocco had no diplomatic ties, such as Russia and Prussia, under the same conditions as those enjoyed by the nations that had treaty relations. Information about the Sultan's desire for friendly relations did not reach Benjamin Franklin, the American emissary to the Kingdom of France in Paris, before April 1778 at the earliest. In 1777, Morocco sought to change its trade relationship with the nascent United States. Sultan Sidi Muhammad Ibn Abdullah actively sought to have an American diplomat negotiate a formal treaty, but meanwhile Moroccan pirates threatened American merchant shipping in the Mediterranean Sea. Finally, Thomas Barclay, the American consul in France, arrived in Morocco in 1786. There, he negotiated the Moroccan–American Treaty of Friendship with Sidi Muhammad, Sultan of Morocco, which was signed on June 23, 1786.

The Treaty was signed in Europe by American diplomats John Adams and Thomas Jefferson and ratified by the Confederation Congress (under the Articles of Confederation government which preceded the current constitutional government) in July 1787.Priscilla H. Roberts and Richard S. Roberts, Thomas Barclay (1728–1793): Consul in France, Diplomat in Barbary (Lehigh University Press, 2008), pp. 189–223.

One of the many letters between American and Moroccan officials was written by the first U.S. President George Washington to Mohammed Ibn Abdullah. On December 1, 1789, eight months into his presidency, Washington wrote on his authority and leadership of the United States as well as the miscommunication between Morocco and America. In the letter, Washington expresses his regrets in lack of punctuality but clarifies that the untimely response was due to a change in government and the desire to communicate on solidified terms. Washington also shows appreciation for Mohammed Ibn Abdullah's diplomatic initiative tactics in the protection of American ships from pirates. These actions are appreciated because of the lack of power the United States as a country had held at the moment. Morocco was the first Berber, Arab, African, and Muslim state to sign a treaty with America. America lacked a navy at the time and was unable to defend its ships in the Mediterranean.

Abd ar-Rahman In 1826, Sultan Abd ar-Rahman intervened on behalf of Abdul Rahman Ibrahima Sori, a Muslim Fula nobleman enslaved in the US, after having read a letter Sori had sent to his family in Africa. Andrew Jackson capitalized on this event in his campaign against President John Quincy Adams before the presidential elections held in 1828.

American Civil War

During the American Civil War, Morocco reaffirmed its diplomatic alliance with the United States (Union). Morocco also became the scene of a colorful foreign relations and political warfare episode involving the Kingdom of Morocco, the United States of America, the Confederate States of America, France, and Great Britain.

In 1862, Confederate agents Henry Myers and Thomas Tate Tunstall were arrested by the Moroccan police on orders of US Consul James DeLong. Tunstall and Myers had been dispatched by Confederate naval commander Raphael Semmes to purchase coal for the CSS Sumter, which was docked at Gibraltar. Semmes actively pleaded with the British consul John Drummond Hay to obtain the release of the prisoners, to which Hay responded that he could only convey the message but not offer any recommendation for actions, as offering a recommendation would violate Britain's terms of neutrality. Semmes tried a similar tactic with the French consul, but without success.

Eventually, a crowd of European citizens living in Morocco protested outside the American consulate, demanding the prisoners' release. The US consul was able to obtain Morocco's consent to transfer the prisoners to a US Navy ship, which took them to Fort Warren prison in Boston by way of Cadiz, Spain.

As a result of the affair, Lincoln withdrew consul DeLong. Having been irritated by Morocco's response, the Confederate States were never able to recover and manage relations with Morocco. In 1863, the King of Morocco released an official order stating in part: "... the Confederate States of America are fighting the government with whom we are in friendship and good relations... if any vessel of the so-called Confederate states enters your port, it shall not be received, but you must order it away on pain of seizure; and you will act on this subject in cooperation with the United States...."

During the spring of 1864, the 1862 CSS Georgia, a Confederate screw steamer, arrived off the coast of Mogador as a reprieve from a hard winter's sail. Upon arrival, the crew was able to lower their boats and row towards the shore. Upon landing, the crew was greeted by hostile Moroccans who knew both who they were and that their government was hostile towards them, despite spoken neutrality. The officers were then forced, at gunpoint, back towards the sea and into the boats from which they arrived. Back on the ship, Captain Matthew Fontaine Maury ordered a shot from the Georgia's ten–inch turret gun, followed by a salvo bombardment. No Moroccan casualties were recorded due to their retreat from the shore during the initial shot fired. This marked the only time during the American Civil War that Confederate guns were fired anywhere besides North America.

Late 19th and early 20th century At the end of the American Civil War, the first international convention ever signed by the United States, the 1865 Spartel Lighthouse Treaty, dealt with a navigational aid erected on the Moroccan side of the Strait of Gibraltar. The Treaty, which was ratified by Morocco, U.S. President Andrew Johnson, and nine European heads of state, granted neutrality to the lighthouse, with the condition that all ten signatories to the agreement assumed responsibility for its maintenance.

During the First Moroccan Crisis, the United States affirmed the Morocco's right to its continued sovereignty at the Conference of Madrid (1880) and the Treaty of Madrid (1880), and again at the Algeciras Conference in 1906. President Theodore Roosevelt played an important role in settling the affair during the 1906 Algeciras Conference. Elihu Root, his Secretary of State, declared, "Fair play is what the United States asks - for Morocco and for all the interested nations - and it confidently expects that outcome." citing Papers Relating to the Foreign Relations of the United States, 1905-1906, 28 November 1905, Washington DC, GPO 1906-1909 President Roosevelt offered a compromise plan which the European powers accepted. The proposal granted Morocco a greater deal of autonomy and allowed for all European nations to trade with Morocco.Holmes, James R. Theodore Roosevelt and World Order. Washington DC: Potomac Books Inc, 2006, pp. 191–201

In 1912, after Morocco became a protectorate of Spain and France, American diplomats called upon the European powers to exercise colonial rule that guaranteed racial and religious tolerance.

World War I – World War II

During World War I, Morocco was aligned with Allied forces. In 1917 and 1918, Moroccan soldiers fought alongside U.S. Marines at Chateau Thierry, Mont Blanc, and Soissons.

With France occupied by the Nazis during World War II, colonial French Morocco was under the control of Axis powers-aligned Vichy France. When the Allies invaded Morocco on November 8, 1942, as part of Operation Torch, the defenders yielded to British and American forces. Shortly after the surrender and defection of Vichy forces in Morocco, President Franklin D. Roosevelt sent a message to Morocco's King, H.E. Mohammed V, commending him on the "admirable spirit of cooperation that is animating you and your people in their relationships with the forces of my country. Our victory over the Germans will, I know, inaugurate a period of peace and prosperity, during which the Moroccan and French people of North Africa will flourish and thrive in a manner that befits its glorious past."

In July 1943, President Roosevelt, British Prime Minister Winston Churchill, and Free French commander General Charles De Gaulle met for four days in the Casablanca suburb of Anfa to discuss the occurring war. During the Casablanca Conference, the Allies agreed that the only acceptable outcome of the conflict was the "unconditional surrender" of the Axis forces. President Roosevelt also conferred privately with King Mohammed V to assure him that the United States would support Morocco's quest for independence from France. Moroccans would fight alongside Americans, notably in the form of the Moroccan Goumier units, for the remainder of WWII.

1944–1955 Following the end of World War II, the US military maintained several installations in Morocco because the Mediterranean had become central to the country's European defense strategy. This was made possible by the French government, which had granted the United States several naval and air bases in its North African protectorate.

This development brought about the stationing of an increasingly large number of soldiers on Moroccan soil. Many of these servicemen were eventually approached by Moroccan nationalists who sought to internationalize their struggle for independence.