Morocco was a Barbary Pirate state. Morocco did prey on US shipping during the revolution, and the Treaty of Marrakech was the direct result of extortion by Morocco on the United States for tribute.
source
The US Peace delegation to Paris in 1784 Jefferson, Adams, Franklin were sent to negotiate commerce with the principal states of Europe and the Mediterranean — including the Barbary states. Already in Europe, the commissioners quickly learned that the Europeans made peace with the Barbary powers through treaties that involved annual payments of tribute ... Congress did decide that peace was to be bought. They authorized $80,000 for negotiations. The Commissioners sent American consul Thomas Barclay to Morocco and Connecticut sea captain John Lamb to Algiers. In Morocco the draft treaty Barclay carried with him was accepted with only minor changes. Jefferson, Adams and Congress were very satisfied; the Morocco treaty made American vessels safe from Moroccan corsairs
"The Betsy" seized by Morocco in 1784 was the first United States ship seized at sea. The Betsey was a merchant brig and was seized off the coast of Spain. Great Britain recognized the independence of the U.S. by the Treaty of Paris signed in September 1783. U.S. ships ceased to be covered by the tribute Britain was paying to the Barbary pirates at that time. Having a treaty with one pirate nation did not mean you were safe from the other pirate nations. Morocco was in negotiation with the US at the time Jefferson was in Paris to get the United States to pay her tribute, like all of the European nations paid the Barbary pirates tribute. The US declined and that's why they took the Betsy. To coerce the United States into a tribute plan.
source
The news of the ship's(Betsy) capture by Moroccan pirates reached the U.S. in 1785:
The situation was satisfactorily resolved with the friendly intervention of Spain's foreign minister, conde de Floridablanca. Besides spreading goodwill, the minister was eager to resolve the Mississippi question in North America and hoped that his intercession would help to maintain cordial relations with the United States—a potentially valuable regional ally against the British. On July 9, 1785, the emperor of Morocco liberally agreed to release the Betsey, including her crew and her cargo, in exchange for America's pledge to send a peace negotiator very soon to conclude a formal treaty. During the intervening months, the cargo and ship were lost, but Moroccan affability prevailed and restitution was made. (London, Victory in Tripoli, pp. 27-28).
No coincidence Algeria declared war on the United States the very same year. Which we solved with Annual tributes.. (for a while)
source
in 1795 when America finally did make peace with Algiers, agreeing to pay annual tribute. The following year, once the US met its initial treaty commitments, the Americans held in Algiers were freed, including the few survivors from the Maria and the Dauphin. Treaties were also concluded with Tripoli, in 1796, and Tunis in 1797. Soon after, American consuls were appointed in each Barbary state
The United States would fight two wars with the Barbary Pirates.
What was the long term ramifications of the United States tussle with the Barbary Pirates? Thomas Jefferson and the Democratic Republicans recognized the worth of a standing professional navy. Lots of tribute paid in the mean while.
A great origin story of how we went from paying tribute to armed struggle. It wasn't a foreign policy derived in Washington but involving one of the really heroic block heads of American History... William Eaton.
Eaton had run away from home at 16 to join the colonial army. He had risen to officer under Washington. Had made and lost a fortune. He had been a spy master for President Adams who had helped thwart a Spanish invasion of Georgia. Now Adams would send William Eaton a "Man of Action" on a diplomatic mission to Tunisia, to the Barbary Pirates where he would get in all sorts of trouble.
- He whipped a Frechman who the United States had hired due to his familiarity with the Barbary Pirates after Eaton had found the man was double dealing (Joseph Etienne Famin).
- He told the Bey of Tunisia who had protected Famin that he would have whipped the man even if he were in the kingdom of heaven.. which the Bey found amusing.
Eaton would then be called to Tripoli to help another Adams appointee and thats where all the wheels would come off.
Eaton found the Barbary Pirates detestable, and he was an ideologue caught up in American fervor. He basically starts the first Barbary war. Get's recalled by Jefferson, and then returns largely on his own dime and invades Tripoli with like a half dozen marines, and almost wins. (Yes that's where the lyrics to the American Marine Hyme come from.. shores of tripoli"... Anyway the story is a great one.. I can't find all the sources right now, and it's out of scope. Maybe a future question.
William Eaton'sdescription of Bey Yusef of Tripoli at their first meeting:
“He was a large, vulgar beast, with filthy fingernails and a robe so spotted with spilt food and coffee that it was difficult to distinguish the orginal color of the garment…. [H]e rarely bathed, if ever, and the stench of his body, which mingled with the powerful scent he used to disguise the odors, made me want to retch…. He was an evil man, but evil in a petty, mean way. There was no grandeur in his bearing, his manner or his speech. There are tyrants who clothe themselves with regality, but Yusef Karamanli was not of their number. In Philadelphia he would have been a worker at the docks unable to find employment; in New York, he would have been a cutpurse hanged at the gallows; but such are the ways of Barbary that in Tripoli he was the master of the world.”