As I understand it, as the Somali state failed, foreign fishing vessels took advantage of the missing government and misdirected leftover Somali coastguard to slip in and illegally fish out the local waters. This decimated the local economy. A bunch of out of work, starving fishermen sat around and looked at their boats, empty nets and left over coast guard gear and asked themselves "now what?" Justified anger led them to simply attack the offending fishing boats wantonly, but they soon realized that there was cash in them-thar ships.
From there, it quickly spiraled out of control. That much money available, combined with the local anger and desperation, quickly made all ships targets. Calls for "the end of piracy" sound to the locals like "please sit there and starve quietly by the coast we fished out like good world citizens."
This is why even magic comic book rifles that can bend bullets won't end piracy. Sitting and starving is not an option.
Personally, I've been impressed so far by the restraint the international community has shown in dealing with the pirates. The temptation to just load cargo ships with old WWII guns and blaze away must be no small thing.
I just really really hope we don't get a "war on piracy" out of this whole deal. I'm pretty much "war on X'ed" out.