a British convoy carrying war material on the way to Melilla was intercepted and captured by the Spanish Navy. At the same time, the troops of the Ottoman Empire began to encroach on Morocco's eastern borders. Spanish troops resisted the attack over a period of 100 days, over which time some 12,000 projectiles were lobbed onto the city. Sherlock began to break the siege, a situation exacerbated by the desertion of Sidi Mohammed's Algerine mercenaries. The siege ended on 19 March with the Spaniards suffering casualties of 600 killed or wounded. With the Treaty of Aranjuez in 1780, Morocco recognised Spanish rule over Melilla, however Spain ceded territories to Morocco in return. Relations with the United States On 20 December 1777, Morocco became the first nation to recognize the United States of America as an independent nation. On the same day, the Dutch consol in Salé was instructed by the Sidi Mohammed to write letters on his behalf to the European merchants and consuls in Tangier, Salé, Larache, and al-Sawira, declaring that any vessel sailing under the American flag can freely enter Moroccan ports. Due to the continued delays of the American government in negotiating a treaty with Morocco, Sidi Mohammed issued an order to seize an American ship, and on 11 October 1784, the Moroccans captured the Philadelphia merchant ship Betsey after it left Cádiz on its way back to the United States. The ship and crew was captured and taken hostage to Tangier. Shortly after, the sultan announced that he did not confiscate the ship nor cargo, and that the ship, the cargo, and the men would be released once a treaty was concluded with the United States. The seizure of the ship led to the Americans having to take action and preparing for negotiations with Morocco. The Moroccan–American Treaty of Friendship, also known as the Treaty of Marrakesh, was signed on 28 June 1786. It was the first treaty signed between the United States and any Muslim, Arab, or African country. It was signed first by American diplomat Thomas Barclay and the sultan, then by Jefferson and Adams, and was ratified by the Congress of the Confederation in July 1787. The treaty has withstood transatlantic stresses and strains for more than 234 years, making it the longest unbroken treaty relationship in the history of the United States. Marriages, concubines and children Sidi Mohammed was polygamous and had