Morocco was the first country to publicly recognize United States independence during the Revolutionary War.
On December 20, 1777, Sultan Mohammed III declared that American ships could enter Moroccan ports and receive safe passage through Moroccan waters. This made Morocco the first head of state to publicly recognize the United States while the war was still underway.
The recognition did not immediately create a completed treaty. Diplomatic negotiations eventually produced the Moroccan–American Treaty of Peace and Friendship, signed in 1786 and 1787. The agreement established commercial and diplomatic relations between the United States and Morocco and became the first treaty between the United States and a non-European state.
France was the most important military ally of the American revolutionaries and formally recognized the United States through the 1778 Treaty of Alliance. That role can cause confusion, but France was not the first country to publicly recognize American independence. Morocco’s early action is a distinctive example of the new republic’s international connections.