In 1638, while the Venetian fleet was cruising off Crete, a corsair fleet from Barbary consisting of 16 galleys from Algiers and Tunis entered the Adriatic. When the fleet returned, the corsairs repaired to the Turkish stronghold of Valona. The Venetian commander Marino Cappello attacked the corsairs, bombarded the forts and captured their galleys, freeing 3,600 prisoners. The sultan reacted to the bombardment of his fortress by arresting the Venetian "bailo" (ambassador) in Constantinople, Alvise Contarini. War was momentarily averted and the matter settled by diplomacy; however, six years later the Ottoman attack against Candia, the main Cretan port, left no easy terms to resort to. The Cretan War lasted for some 25 years and was the dominant question of the whole Republic's history in the 17th century.