Well, we did not have to attack any muslim country for the BPs to tear into us. This is a fact in contradiction of brer's contention.
...in 1786, Thomas Jefferson and John Adams, then serving as American ambassadors to France and Britain, respectively, met in London with the Tripolitan Ambassador to Britain, Sidi Haji Abdul Rahman Adja. These future American presidents were attempting to negotiate a peace treaty which would spare the United States the ravages of jihad piracymurder, enslavement (with ransoming for redemption), and expropriation of valuable commercial assetsemanating from the Barbary states (modern Morocco, Algeria, Tunisia, and Libya). During their discussions, they questioned Ambassador Adja as to the source of the unprovoked animus directed at the nascent United States republic. Jefferson and Adams, in their subsequent report to the Continental Congress, recorded the Tripolitan Ambassadors justification:
& that it was founded on the Laws of their Prophet, that it was written in their Koran, that all nations who should not have acknowledged their authority were sinners, that it was their right and duty to make war upon them wherever they could be found, and to make slaves of all they could take as Prisoners, and that every Mussulman who should be slain in Battle was sure to go to Paradise
No attacks were required by us to get the BPs to be hostile.
You were right, in that TJ did not finish off the BPs. He foolishly took some action, but then came to a mutually-agreeable settlement before grinding them up. It took until 1815 to polish off the savages:
...President Madison commissioned two naval squadrons led by Commodores William Bainbridge and Stephen Decatur, and dispatched them to the Barbary States in May, 1815. By June/July 1815 the ably commanded U.S. naval forces had dealt their Barbary jihadist adversaries a quick series of crushing defeats. These U.S. victories were solidified by what London terms unprecedented treaty agreements forced upon the Barbary states, which ..made practically no concessions and stood very firm on every pointthe abolition of all tribute; release of all American prisoners currently held, and acknowledgement that no future American prisoners of war could be enslaved; the payment of indemnities; and the restoration of American properties held by the dey.
1. No aggression by the US was required for the BPs to be aggressive towards us
2. Treating with them as if they were rational actors by coming to mutually-agreeable terms that left both parties largely intact were unsuccessful
3. Relief from BO aggression only occurred after dealing them crushing defeats