Charles V meets with the Bey of Tunis, 1535. Both Habsburg and Ottoman power in North Africa depended in part on agreements with local clients. Here the size of the Imperial expedition of 1535 is apparent. Note the lines of galleys in the bay to the upper right - projecting power across the Mediterranean took enormous resources.
The Ottoman sultan, especially after the conquest of Mameluke Egypt in 1517 (during the first year of King Charles's reign), enjoyed his own growing influence along the central North African coast. The sultan's most successful client was Khayr ad-Din, the Barbary pirate better known as Barbarossa for his red beard. Fearful of the growing Spanish influence which threatened his corsairing, in 1518 Barbarossa pledged himself to the sultan Selim and in return received a title and military aid. With a large galley fleet and a mixed army of Maghrebis, Christian renegades, Moorish refugees from Spain and Turkish adventurers, Khayr ad-Din seized Algiers (1529) and Tunis (1534) from local Muslim rulers. In 1533 Süleyman made the pirate his high admiral with all the substantial resources of the Galata dockyards at Constantinople. Barbarossa continued to plague the shores and shipping of Christian Europe until his death in 1546. These were not insubstantial raids, threatening only unlucky fishermen and villagers, but major acts of war. In 1543, his most spectacular year, Barbarossa first sacked Reggio Calabria (for the second time) and then, cooperating with the sultan's French allies, the city of Nice (a possession of the Spanish-allied Duke of Savoy). The war in North Africa and on the waters of the western Mediterranean thus became a confrontation between the emperor Charles and the sultan Süleyman.
In Charles's first Mediterranean offensive he personally led the great invasion fleet and 25,000-man army that sailed from Barcelona to take Tunis in 1535, a direct response to Barbarossa's seizure of the city the previous year. The fortified island of Goletta off Tunis became one of the principal Spanish forts of the Maghreb, and the southernmost position of a Habsburg cordon stretching down from Naples, Sicily and Malta to block further Ottoman expansion. Süleyman replied to the loss of Tunis with a planned invasion of Italy in 1537, landing a preliminary force of horse under the command of an Italian renegade to scour the countryside of Apulia. To secure his crossing to Italy Süleyman first laid siege to the Venetian fortress of Corfu, extensively protected by massive new-style fortifications. The Turkish besiegers proved incapable of reducing the Venetian citadel, and the entire operation had to be abandoned. The next year Charles continued the Spanish offensive, his Genoese admiral Andrea Doria taking Castelnuovo (now Herceg Novi) in Montenegro. In the late summer of 1539 Barbarossa retook Castelnuovo at a tremendous cost of life. Neither power could successfully bridge the straits of Otranto.
In 1541 Charles directed an enormous fleet against Algiers, a twin to his successful operation against Tunis in 1535. Again the emperor was personally in command, and success looked certain: Barbarossa was in the eastern Mediterranean; the janissary garrison tiny. But soon after disembarking a tremendous three-day gale utterly wrecked the supporting Spanish fleet, and the invading force (reduced to eating their horses) had to be evacuated. For almost ten years following this Spanish disaster there were no major land operations in the Mediterranean.