they successfully combatted pirates in tripoli and algeria