In 1557, King Philip II of Spain appointed him Viceroy of Sicily, a position he held until 1564. During that time he besieged with a fleet the North-African harbor of Tripoli, now in Libya, dealing with Dragut, a Turkish privateer and Ottoman admiral. The force, including ships from Spain, Genoa, Tuscany, the Knights of Malta and the Papal States, was however nearly destroyed in the Battle of Djerba.