The Crown Prosecution Service has published guidelines for prosecutors indicating when they should apply for the withdrawal of the automatic anonymity that applies to offenders convicted at youth court. The push to have young rioters "named and shamed" goes against established case law – and indeed the spirit of the legislation that allows it.

The guidance says there is now a strong public interest in naming young offenders where there has been:

• significant public disorder where the public will rightly need to be satisfied that offenders have been brought to justice and there is a need to deter others;

• serious offences which have undermined the public's confidence in the safety of their communities;

• hate crimes which can have a corrosive impact on the confidence of communities.

This a big departure from previous CPS policy. In my experience it is not the CPS that applies to have offenders "named and shamed" – it is usually a court reporter from a local paper who has enough knowledge of the law and confidence to speak up. Now the CPS is advising its own prosecutors to make such applications.

It is also a departure from the guidance previously given to the courts on when withdrawal of anonymity would be appropriate. The Crime (Sentences) Act 1997, a piece of Conservative legislation given effect by Tony Blair's incoming Labour government, contained the so-called "naming and shaming" provision allowing youth courts to dispense with a young offender's anonymity upon conviction.

Until then no one, not even the lord chancellor or home secretary, could order a child convicted in youth court to be named. The drafters of the 1933 Children and Young Persons Act had created a fairly watertight law aimed at keeping the youth justice system separate from the adult one.

They had the foresight to try to create a youth justice system where young offenders were separated from older ones who might lead them further astray. They intended that a young offender should be punished, but, crucially, should then be allowed to rejoin society without an offence committed in their youth blighting their life.

By the 1990s the political mood had changed and young offenders were perceived as a particular problem. Naming and shaming was introduced, and that is what the home secretary is asking CPS prosecutors to use.

However, when this legislation was introduced, guidelines were issued to the youth courts by the then lord chancellor's department and the Home Office, explaining when it would be appropriate to use this legislation. Courts should consider withdrawing anonymity, the circular said, where the offending was persistent, serious, affected a large number of people and where identifying the offender might prevent further offences.

It added that the courts might consider maintaining anonymity if the offender was particularly young and vulnerable; contrite and willing to accept responsibility for the offence; and where identifying them might identify a vulnerable sibling who would suffer as a result.

Some of the charges that have been brought against children involved in the riots will satisfy some of the conditions above. Others may not. The events certainly affected a large number of people, but were they persistent? The court would have to satisfy itself that the child was a persistent offender before it could "name and shame" them.

While the context of the offending was serious, some of the offences charged are relatively minor – the theft of a £7.49 bottle of wine by one youth, for instance. So the lifting of anonymity will depend on whether the court views the background of the riots as an aggravating factor in the offence itself.

It ought to be noted by sections of the media baying for the naming of these child offenders that "naming and shaming" as an additional punishment – over and above the sentence – was ruled unlawful by the high court in 2001 in McKerry v Teesdale and Wear Valley Justices. In this case, contrary to what government ministers might have you believe, the late Lord Bingham (then lord chief justice) said it was hard to see a case for "naming and shaming" , that it would be rarely in the public interest to remove anonymity and that youth court magistrates needed to be clear in their minds on how the public interest is served by making such an order.

The new CPS guidance makes clear reference to the McKerry case, though it is hard to square the new guidelines with Lord Bingham's judgment. In the clamour for swift and public justice for young offenders caught up in the events of last week, his calm words have more relevance than ever.

David Banks is a media law consultant and is co-author of McNae's Essential Law for Journalists