Nobody comes well out of the decision to permit Britain's released Iran hostages to sell their stories. But whose judgment should we criticise first when there are so many candidates jostling for censure? Step forward the defence secretary, Des Browne, who last night announced a ban on military personnel selling their stories to the media, pending an internal review of procedures. He was shutting the stable door after the horse had bolted. Mr Browne said he wanted to be sure that there was clear guidance for the future. There is little doubt that this is needed. The command structure of the armed forces collapsed on first contact with the Fleet Street chequebook. But nor should a free pass be given to the beasts of the media, so often happy to wave the flag and get behind our boys (and now our girl) but then, when it suits, to tempt them with gold. And after all that, they're now surfing their own story, denouncing the authorities for giving in to them.

Nor is there much cause for pride in the performance of the hostages, who are apparently trained to resist a ruthless enemy but, in some cases, have surrendered to Rupert Murdoch even faster than they gave in to their Iranian interrogators. Not even the hostages' families can be exempted; last week they were anxious relatives undergoing a cruel ordeal, but now they have dried their tears and grabbed a slice of the loot.

It's important to understand the changed culture in which the modern military now operates. Many traditional military assumptions are unsustainable in a world in which service personnel are volunteers with human rights and mobile telephones. In many ways, this is a change to be welcomed: there is no way that first world war commanders could have sent a generation to be slaughtered on the Western Front if our great-grandfathers had been blogging each night from Picardy.

Nevertheless, the MoD's original concession of a "right" to sell one's story was a corrosive precedent, as well as deeply offensive to many service families. But it was also the latest step in the process by which defence policy has become increasingly constrained by democracy, law and human rights and in which the general staff's capacity to make war as it sees fit - certainly to fight a politically controversial elective war such as that in Iraq - has been subverted not so much by disobedient squaddies as by squaddies' families with access to lawyers, Max Clifford and the media.

It is no good wringing one's hands and saying that ours has regrettably become the kind of society in which things like this must now be expected to happen. We can do better than that - which is why an inquiry into the wider issues (rather than the one announced last night) could be helpful in drawing a line. Faye Turney and Arthur Batchelor have not behaved well, but it would be hypocritical to single them out for criticism when Sir Christopher Meyer did the same thing when he retired as British ambassador in Washington or when Alastair Campbell is poised to do the same thing with his diaries of the Blair years.

The challenge is to re-establish rules that work - and then to be prepared to enforce them. This means enforcing them not just on soldiers and sailors but on publishers and journalists, civil servants and politicians. It involves standing up to the claim that there is a public interest in the media publishing everything it can get its hands on at any time. There have to be secrets and there have to be no-publicity rules to protect them either absolutely, as there still are for secret-service personnel, or for reasonable periods of time, as is still nominally the case for civil servants and ministers. Ultimately the reason for such rules is the same - because the system will fall apart if they are not applied. Our defence forces cannot function if their personnel are free not just to take the Queen's shilling but Mr Murdoch's too.