Who imagined that in 2009, the world's governments would be declaring a new War on Pirates? As you read this, the British Royal Navy – backed by the ships of more than two dozen nations, from the US to China – is sailing into Somalian waters to take on men we still picture as parrot-on-the-shoulder pantomime villains. They will soon be fighting Somalian ships and even chasing the pirates onto land, into one of the most broken countries on earth. But behind the arrr-me-hearties oddness of this tale, there is an untold scandal. The people our governments are labelling as "one of the great menaces of our times" have an extraordinary story to tell – and some justice on their side.

Pirates have never been quite who we think they are. In the "golden age of piracy" – from 1650 to 1730 – the idea of the pirate as the senseless, savage Bluebeard that lingers today was created by the British government in a great propaganda heave. Many ordinary people believed it was false: pirates were often saved from the gallows by supportive crowds. Why? What did they see that we can't? In his book Villains Of All Nations, the historian Marcus Rediker pores through the evidence.

If you became a merchant or navy sailor then – plucked from the docks of London's East End, young and hungry – you ended up in a floating wooden Hell. You worked all hours on a cramped, half-starved ship, and if you slacked off, the all-powerful captain would whip you with the Cat O' Nine Tails. If you slacked often, you could be thrown overboard. And at the end of months or years of this, you were often cheated of your wages.

Download the new Independent Premium app Sharing the full story, not just the headlines

Pirates were the first people to rebel against this world. They mutinied – and created a different way of working on the seas. Once they had a ship, the pirates elected their captains, and made all their decisions collectively, without torture. They shared their bounty out in what Rediker calls "one of the most egalitarian plans for the disposition of resources to be found anywhere in the eighteenth century".

They even took in escaped African slaves and lived with them as equals. The pirates showed "quite clearly – and subversively – that ships did not have to be run in the brutal and oppressive ways of the merchant service and the Royal Navy." This is why they were romantic heroes, despite being unproductive thieves.

The words of one pirate from that lost age, a young British man called William Scott, should echo into this new age of piracy. Just before he was hanged in Charleston, South Carolina, he said: "What I did was to keep me from perishing. I was forced to go a-pirateing to live." In 1991, the government of Somalia collapsed. Its nine million people have been teetering on starvation ever since – and the ugliest forces in the Western world have seen this as a great opportunity to steal the country's food supply and dump our nuclear waste in their seas.

Yes: nuclear waste. As soon as the government was gone, mysterious European ships started appearing off the coast of Somalia, dumping vast barrels into the ocean. The coastal population began to sicken. At first they suffered strange rashes, nausea and malformed babies. Then, after the 2005 tsunami, hundreds of the dumped and leaking barrels washed up on shore. People began to suffer from radiation sickness, and more than 300 died.

Ahmedou Ould-Abdallah, the UN envoy to Somalia, tells me: "Somebody is dumping nuclear material here. There is also lead, and heavy metals such as cadmium and mercury – you name it." Much of it can be traced back to European hospitals and factories, who seem to be passing it on to the Italian mafia to "dispose" of cheaply. When I asked Mr Ould-Abdallah what European governments were doing about it, he said with a sigh: "Nothing. There has been no clean-up, no compensation, and no prevention."

At the same time, other European ships have been looting Somalia's seas of their greatest resource: seafood. We have destroyed our own fish stocks by overexploitation – and now we have moved on to theirs. More than $300m-worth of tuna, shrimp, and lobster are being stolen every year by illegal trawlers. The local fishermen are now starving. Mohammed Hussein, a fisherman in the town of Marka 100km south of Mogadishu, told Reuters: "If nothing is done, there soon won't be much fish left in our coastal waters."

This is the context in which the "pirates" have emerged. Somalian fishermen took speedboats to try to dissuade the dumpers and trawlers, or at least levy a "tax" on them. They call themselves the Volunteer Coastguard of Somalia – and ordinary Somalis agree. The independent Somalian news site WardheerNews found 70 per cent "strongly supported the piracy as a form of national defence".

No, this doesn't make hostage-taking justifiable, and yes, some are clearly just gangsters – especially those who have held up World Food Programme supplies. But in a telephone interview, one of the pirate leaders, Sugule Ali: "We don't consider ourselves sea bandits. We consider sea bandits [to be] those who illegally fish and dump in our seas." William Scott would understand.

Did we expect starving Somalians to stand passively on their beaches, paddling in our toxic waste, and watch us snatch their fish to eat in restaurants in London and Paris and Rome? We won't act on those crimes – the only sane solution to this problem – but when some of the fishermen responded by disrupting the transit-corridor for 20 per cent of the world's oil supply, we swiftly send in the gunboats.

The story of the 2009 war on piracy was best summarised by another pirate, who lived and died in the fourth century BC. He was captured and brought to Alexander the Great, who demanded to know "what he meant by keeping possession of the sea." The pirate smiled, and responded: "What you mean by seizing the whole earth; but because I do it with a petty ship, I am called a robber, while you, who do it with a great fleet, are called emperor." Once again, our great imperial fleets sail – but who is the robber?

j.hari@independent.co.uk