Legality of ship weapons?

Why was the USA the first to deal with the Barbary Pirates? (Short Animated Documentary)

The Barbary Pirates harassed shipping across the Mediterranean for centuries and in spite of this, it wasn't a European power who struck the first blow against them. It was the Americans in the early 19th century who started their downfall after fighting two wars against them. To find out why it was the Americans that did this instead of the French, the Spanish or the British watch this short and simple animated history documentary.

1. Pay more.

2. Rely on British shipping.