what is the  capital city of libya which  Barbary pirates was also based primarily in