Why? Because they want to stop pirates stealing their boats at gunpoint. So, they’ve fought back.
This should put an end to the mistaken meme that the pirates are selfless warriors fighting against the despoiling of the waters by outsiders. If that were true, they wouldn’t be stealing their compatriot’s boats, now would they?
Coming Anarchy finds it “shocking” that locals could fight back better against pirates than heavily armed outsiders. I don’t. Locals can always do a better job, they know the territory and can blend in effortlessly. How would the pirates even know they are anti-pirates?