Ottoman Mediterranean
The Ottoman Empire had held the Eastern Mediterranean and the North African coastal states (apart from Morocco) in some sort of subservience since the middle of the sixteenth century. Defeat in Malta (1565) and naval defeat at the Battle of Lepanto (1571) slowed their expansion and gave the other Mediterranean countries hope of resisting what had previously seemed an unstoppable force.
Algiers, on Morocco's eastern border, had been a client state of the Ottomans since the early years of the sixteenth century. Once in a while the Ottomans had tried to expand their reach into Morocco, but although they managed to exert influence over some of the Moroccan rulers it was always a tenuous relationship.
In 1659 the Ottoman hold on Algiers was loosened by the revolt of the Corsairs and then the Janissaries. Three years of plague followed by heavy losses of Algerian Corsair ships to the Dutch and the Venetians had resulted in greatly reduced income for the Regency of Algiers. When the newly appointed Pasha diverted cash from the Corsairs to pay the Odjak – Turkish Janissaries - the Corsairs imprisoned him. The Janissaries then revolted and their Council - the Divan – took over the financial administration and governed the country.
The operation of Algerian Corsairs and the enslavement of Christian prisoners continued to bring Algiers into conflict with European powers. In 1661 Charles II sent the Earl of Sandwich to persuade the Dey to Algiers, by force if necessary, to keep to a treaty previously agreed, release English slaves and refrain from searching English ships. Although his mission was not a success, Algerian independence from Ottoman rule effectively shut down any designs the Sultans in Constantinople may have had on Morocco in general and Tangier in particular.
For the first decade of the English occupation of Tangier the Turkish sultans were more likely to be extracting military capability from Algeria to help in their struggles against Venetian Candia (Crete) or the Austrians in Europe than helping the Algerians invade their neighbours.