Britain has a very secure government. We are blessed with a government that doesn't have to worry much about being invaded or overthrown, and can devote its attention to vital issues such as whether people are lying on school application forms.
The people of Somalia are not so blessed. Their government does not have the resources to give its citizens ASBOs or check that only genuine garden waste is placed in the brown bins. Nonetheless, it does the best it can to provide a semblance of order and peace. Unlicensed interior design work may go unchecked, but piracy on the high seas is likely to be punished with beheading.
In one way this is a good thing, because it's actually quite important that cargo travels unimpeded up and down the coast of Africa without being snaffled by Captain Blood and his chums. But, on the other hand, our government officially believes that for a pirate to have his head detached, anywhere in the world, is an infringement of his human rights.
Therefore, the Royal Naval captain that encounters these miscreants is in a bit of a bind. If he lets them go, trade will continue to be impeded. If he takes them home to Britain, they will get the ASBO they so richly deserve, and can then claim Asylum as potential victims of the Somalians' inhumanity. This is likely to be frowned on by the man in the street. Dropping them off back in Somalia to have their blocks knocked off is right out.
If the Somalis had caught them themselves, there would not have been an issue. Heads would be removed, trade would flow, Amnesty International would increment a box in a spreadsheet, and we would not take our eyes off The Apprentice. But because we want, for our own good reason, to assist the Somalian government in its basic duty to order its territory and territorial waters, the otherwise harmless hypocrisy gets in the way.
The hypocrisy should go. We have our standards, and other people have theirs. If we disagree sufficiently with a foreign government, we might attempt to overthrow and replace it, but that's a big undertaking not to be treated lightly. If we are going to cooperate with foreigners to the extent of subsidizing their infrastructure or sending our leading exponents of the hop-skip-and-jump to compete there, we need to respect their sovereignty.