In August 1844 French forces under General Thomas Bugeaud defeated the Moroccan army in the battle of Isly. The battle was a result of the French government's pursuit of Algerian resistance leader, Abd al-Qadir who had taken refuge in the country. Following the defeat Sultan Abd ar-Rahman of Morocco was forced to accept French presence in Morocco. He also had to agree to remain neutral and not assist any enemy of France in any way. A peace treaty was signed in Tangier on 10 September 1844 and came to be known as the Treaty of Tangier.