Yes indeed. The Barbary Pirates kept attacking American ships, so Washington decided to take them out at the source in their homelands.
Also, the Barbary Coast slave trade of millions of white slaves into Africa by people of color is a thing leftists like to pretend never happened.