WASHINGTON: Pirates have been long maligned and cursed as thieves and sea dogs, but according to one economist they formed vanguard capitalist democracies, with constitutions, elections and healthcare plans.

With images of gun-toting Somali pirates recently aired on television screens across the world, Peter Leeson, has set himself the unenviable task of salvaging the reputations.

The economics professor at George Mason University outside the US capital, says he has found evidence that some 18th century pirates wrote down rules and principles which foreshadowed the US Constitution by decades.

"We have three or four surviving accounts of pirate constitutions," Leeson said.

Pirates had concluded through their rules that "we are going to use democracy to determine a lot of our decisions, we are going to split up the booty this way, we are going to establish a workers' compensation scheme, a system of social insurance," Leeson said.

One text, linked with Captain Bartholomew Roberts -- or "Black Bart," a Welsh pirate who prowled the Caribbean in the 18th century -- gives a clue into how structured pirate societies may have been.

"It has regulations on smoking, regulations on drinking, regulations on gambling, in addition to the sorts of normal rules that provide social order, such as prohibition on violence and theft and a means to enforce these things.

"It is different from other criminal organizations," he said pointing to the Sicilian Mafia's hierarchical power structure.

"On a pirate ship it is exactly the opposite. The leaders are only leaders by virtue of the fact that the guys on the bottom have selected them."

But if constitutionalism seems at odds with images of a grog-swilling life of high-seas pillage, then Leeson, in his book "The Invisible Hook," says economics -- and in particular Adam Smith's brand -- can explain a lot.

"They adopted those practices simply because it allowed them to profit," said Leeson.

"It does not take much thought to realize: 'Well, we are both thieves, you like stealing and I like stealing. We are both violent, so you like stabbing people and I like stabbing people.... We need some honor among thieves.'"

But true to violent stereotypes, punishments were severe -- lashings were common, although walking the plank was not, said Leeson.

"Marooning was also an important means of enforcement, as the pirates said 'to make someone the governor of his own island,' they would put you on an island with a pistol, one shot and a bottle of water. That was it," he said.

Pirates also employed a punishment known as "keel hauling," which would see an unfortunate soul dragged across the barnacled hull of a ship.

Still, along with proscriptive rules came sophisticated efforts to promote "good" behavior.

"In order to encourage their crew members to give it their all during battle... they need to incentivize people in some way, so they created a workers' compensation system.

"They would assign different values to different body parts. Each of these appendages would get a value according to how much they thought it was worth to them as a crew."

In one instance, injured or older crew members were even given a share of profits for as long as the group existed, despite being unable to take part in raids.

Unfortunately for today's ship owners, modern Somali pirates may be starting to replicate the system that made yesteryear's Caribbean pirates among the most successful criminals in history.

"They are starting to develop some private systems of governance that are similar to what early 18th century pirates had," said Leeson.

"They now have a traveling pirate court for example, they have created some rules to prevent theft and violence. You have enough members of the modern Somali pirate community to really make a society, an outlaw society."