Original sentence: Algiers became a base in the war against Spain, and also in the Ottoman conflicts with Morocco.The Regency of Algiers was the principal center of Ottoman power in the Maghreb
Edited sentence: Algiers became a base in the war against Spain.The Regency of Algiers was the principal center of Ottoman power in the Maghreb, although, Algeria was autonomous from 1689.The deys, chosen from within the military caste, governed Algeria independently from the Ottoman government.The regency of Algiers was transformed into a sort of military republic when the troops stationed there rebelled against the Ottoman governor in 1689 and installed one of their officers as ruler, giving him the title of dey (maternal uncle).They retained religious ties to the Ottoman sultan, however, by recognizing him as caliph and by making the Ḥanafī school of law—the official school of the Ottoman Empire—the official school of law in Algeria as well