Piracy remains a concern for ships passing the Horn of Africa, even though the number of incidents has plummeted since 2011, when armed protection was beefed up on board many large vessels. The topic grips the public imagination. Witness the success of "Captain Phillips," a film in which a vessel captained by the actor Tom Hanks is hijacked by Somalis. Yet the pirate economy is poorly understood. A report released Monday by the World Bank, the U.N. and Interpol sheds new light.

The authors interviewed current and former pirates, their financial backers, government officials, middlemen and others. The report, entitled "Pirate Trails: Tracking the Illicit Financial Flows from Pirate Activities off the Horn of Africa,'' estimates that between $339 million and $413 million was paid in ransoms off the Somali coast between 2005 and 2012. The average haul was $2.7 million. Ordinary pirates usually are paid $30,000 to $75,000 each, with a bonus of up to $10,000 for the first man to board a ship and for those bringing their own weapon or ladder.

Khat, a narcotic plant that is chewed by many, is often provided to pirates on credit during an operation. Their consumption is recorded and, when the ransom is paid, each pirate gets his share, minus what he consumed.

Other deductions include food and fines for bad behavior, such as mistreating the crew, which often carries a $5,000 fine and dismissal. This is in keeping with centuries-old pirate codes: John Phillips, an 18th-century pirate, was said to have stated that anyone who "meddled" with a woman without her consent "shall suffer present death."

Some pirates find it difficult to retire because they end up in debt at the end of a hijack. Part of the ransom money flows to local communities that provide services to pirates.

Payments go to cooks, pimps and lawyers. Money is also paid to militias that control ports. Under one agreement in Haradheere, a port north of Mogadishu, Somalia's capital, pirates paid a "development tax" of 20 percent to Al-Shabab, an Islamist rebel group tied to Al-Qaida.

During operations, pirates spend with abandon. Interest rates on loaned goods and services are high: $10 of mobile-phone airtime is charged generally at around $20. The men on the anchored ships also pay up to three times the market price for khat, driving up prices on the coast.

Financing pirate expeditions can be quite cheap by comparison. The most basic ones cost a few hundred dollars, which may be covered by those taking part. Bigger expeditions, involving several vessels, may cost $30,000 and require professional financing.

A typical operation has three to five investors. Some provide loans or investment advice to other financiers. Some financiers, especially those in the Somali diaspora who have little cash inside Somalia but large deposits abroad, employ what the report describes as "trade-based money-laundering" to send funds to Somalia.

The same technique is sometimes used to transfer ransom money out of Somalia. Cash also is smuggled across the region's porous borders or transferred through intermediaries. One pirate took $12,000 in $50 and $100 bills to a money-transfer office and wired it abroad, bought a car and shipped it back to Somalia. The Somali financial sector is surprisingly dynamic and growing quickly. Various Internet-payment services have popped up, even in the roughest parts of the country.

The report identifies Kenya, the Republic of Djibouti and the United Arab Emirates (UAE) as the main transit points and final destinations for much of the loot. The financial institutions in Dubai, part of the UAE, are a particular worry. Investigators concluded that the ransom from the hijacking of the MV Pompei in 2012 was moved to Djibouti, then wired to banks in Dubai. It is not known how large the ransom was, but the pirates had demanded $8 million.

A third of pirate financiers invest profits in setting up militias or gaining political influence. Some also finance religious extremists. Ciise Yulux, one of the most active pirate leaders who is reckoned to command up to 70 men, provided money and equipment to fighters linked to Al-Shabab and Al-Qaida in 2012. Much of the rest flows into the khat trade or is used to buy real estate.

Khat-chewing is big (and generally legal) business in much of the region, and the role of Somalis in distributing it is growing. The lack of transparency or monitoring of the khat trade in Kenya, the main supplier to Somalia, makes it susceptible to crime.

Copyright 2013 The Economist Newspaper Limited, London. All Rights Reserved. Reprinted with permission.