Reuters

TIPPED off by friends in ports from Odessa to Mombasa, Somali pirates captured a Ukrainian freighter, the MV Faina, in the Gulf of Aden and steered it to Somalia's coast. At first they demanded $20m for the release of ship and crew. The captain died, apparently of “hypertension”, and several pirates may have then killed each other after a quarrel. This recent incident was only the latest in a long list of similar outrages and highlights the growing menace caused by the total failure of the state of Somalia, the ultimate cause of the virus of piracy in the region.

The ship was carrying 33 T-72 Russian tanks, anti-aircraft guns and grenade launchers. Lighter weapons may have been offloaded on the Somali shore before an American warship arrived on the scene. Kenya claimed ownership of the cargo but the manifest suggests its destination was south Sudan, with Kenya's co- operation in its delivery to be rewarded in the future with cheap south Sudanese oil. At midweek, a Russian warship was steaming to the scene to take responsibility for its citizens on the ship.

The attack was only one of at least 60 off Somalia this year. Foreign navies can intercept vessels captured by pirates, but the desolation and length of Somalia's coastline give them little chance of stamping out piracy without much larger and better co-ordinated forces. In cahoots with gangs in Yemen, Somali pirates look set to go on hitting vessels heading into or out of the Red Sea or passing through the Gulf of Aden: about 10% of the world's shipping.

It is big business. The pirates are increasingly sophisticated, handsomely bankrolled by Somalis in Dubai and elsewhere. They are not yet directly tied up with the Islamist insurgents in Somalia, though they may yet have to pay cash to whoever controls their coastal havens in return for uninterrupted business, thus assisting the purchase of weapons and fuelling the violence. The nabbed ships are mostly anchored off the village of Eyl in Puntland in the north-east or the pirate town of Haradheere farther south (see map) until a ransom is paid, which is usually within a month of capture. The average ransom has tripled since 2007, as has the number of ships taken. Some $100m may have been paid to pirates this year. By comparison, the United Nations Development Programme's annual budget for Somalia is $14m.

Piracy is a symptom of the power vacuum inside Somalia. The country's “transitional federal government”, headed by a warlord president, Abdullahi Yusuf, and a bookish prime minister, Nur Hussein, is powerless to stop its citizens raising the Jolly Roger, just as it cannot halt the resurgent jihadists, some with al-Qaeda connections, who have taken control of much of southern Somalia, including the port town of Kismayo. Hundreds of thousands have fled street fighting in the north of Mogadishu to camps outside the city; some head south to refugee camps in Kenya. About 9,000 civilians have been killed in the insurgency in the past year, according to human-rights groups.

The UN's envoy to Somalia, Ahmedou Ould Abdullah, a former foreign minister of Mauritania, is overseeing peace talks in nearby Djibouti between the transitional government and the moderate wing of the Alliance for the Reliberation of Somalia (ARS), an Islamist group headed by a former teacher, Sharif Ahmed. The aim is to create a genuine government of national unity before elections next year.

A condition of any agreement is the withdrawal of the 7,000-odd Ethiopian troops now in Somalia. Mr Ould Abdullah wants to replace them and a separate 2,200-strong African Union force of Ugandan and Burundian troops with 8,000 UN peacekeepers. Ethiopia, which is losing men and money, would be happy with that, if the peacekeepers were somehow shoehorned in without the jihadists taking advantage of a hiatus. America agrees, but only if the deployment of blue helmets is matched by an effort to build a new Somali national army. Mr Ould Abdullah is also keen for the International Criminal Court in The Hague to indict some of the worst warlords, to show they cannot murder their opponents with impunity.

But it is unlikely, in present circumstances, that UN peacekeepers will ever arrive. If the UN cannot produce half its promised force for Darfur, despite a detailed plan for one, Somalia stands little chance of getting any blue helmets at all.

Feuding among Somali leaders makes matters worse. “Somalia is a victim of its political, business and military elite,” says Mr Ould Abdullah. “They've taken the country hostage.” A slender hope, backed by Britain and some other EU countries, is that ordinary Somalis will eventually force their leaders to put national interest above self-interest and sign the proposed agreement in Djibouti. In any event, says another diplomat, “There is no Plan B.”

As the peace talks limp on, the insurgency is getting stronger. It is led by the Shabab (Youth), the armed wing of the Islamic Courts Union, which ran Somalia with some success for a few months in 2006 until it was smashed, at the end of that year, by the invading Ethiopians, with American backing. The Shabab has since reconstituted itself, making ground with tactics copied from Iraq: roadside bombings, the kidnap and murder of foreigners, local aid-workers and peace campaigners, and grenade attacks on video shacks showing films or football.

My enemy's enemy is my friend

Its fighters come under the leadership of a wily red-bearded 70-year-old jihadist, Hassan Dahir Aweys, and a former deputy commander of the Islamic Courts, Mukhtar Robow. They are backed by Eritrea, which has offered sanctuary to the radical rump of the ARS in its capital, Asmara. Eritrea's interest is not to help Somalia but to hurt its bitter enemy, Ethiopia. The Shabab is also backed by fighters from the Hawiye clan and by hungry young freelance gunmen who represent Somalia's huge lost generation. Half the population, 10m-odd before the exodus, was born after Siad Barre's regime fell in 1991. Since then, it is guessed, only 10% have had even rudimentary education; health care barely exists.

Few foreign governments have shown much interest in trying to end Somalia's woes. Diplomats charged with trying to do so are frustrated and depressed. Meanwhile the suffering is mounting. The UN reckons 3.2m Somalis now survive on food aid. The piracy means that warships have to escort ships bringing food. If fighting intensifies, that will be harder—and manipulating food aid could become a weapon, as it was during fighting in 1991 and 1992, when 300,000 Somalis starved to death.