The scene played out in Portsmouth in the early hours of yesterday morning will have stirred oddly mixed feelings. A first reaction may have been revulsion at the sight of a lynch mob of 150, surrounding the home of a man, overturning and torching a car, apparently demanding his neck. There is something primitive about a baying crowd, driven by a lust for vigilante, string-'em-up justice. And yet, some may well have understood the crowd's anger: they were furious to discover they have a child molester living among them. Some were parents, anxious for the fate of their children. They saw what happened to Sarah Payne, the eight-year-old girl killed last month, and they do not want their child to be next. In their view, the News of the World had peformed a service with its week-by-week roll-call of paedophiles, warning people of the threat in their midst.

The paper's decision to drop its drive to "name and shame", announced last night, gives us all a chance to reflect on what can be done to reconcile these conflicting emotions. Clearly, random vigilante publishing was not the answer. If its objective was the protection of children, then it simply failed. In fact it served the opposite purpose, driving paedophiles underground, where neither police nor probation services could keep track of them. Already the relevant agencies have told of convicted sex offenders, once under their watch, who have now moved off-radar. That has increased the risk to children, not reduced it. It is only a pity the News of the World took so long to realise it.

There was a second danger posed by naming and shaming. As the police themselves pointed out, it created new criminals and new victims. The new offenders were the torchbearers gathered in Portsmouth yesterday. Some were obviously louts, glad for an excuse to make trouble, but some were people who would otherwise abide by the law, suddenly drawn into an overheated situation. The new class of victims are those people mistakenly branded paedophiles and hounded as a result. Police have had to give protection to at least three men wrongly persecuted as child abusers, all thanks to confusion over the NoW list. It is a relief that this kind of mayhem will not be repeated in tomorrow's paper.

The News of the World insists it has not caved in, but rather "just begun" its campaign to protect children. It wants legislation modelled on America's Megan's Law to be adopted over here, a new Sarah's Law, establishing a public register of sex offenders which anybody could look at. The Payne parents support the idea, but even here we need to proceed carefully. Information on a register could well spark just the kind of vigilantism on display in Portsmouth; it could also become out of date or confused and lead to more cases of mistaken identity. The 43 police forces of England and Wales already have a register and Home Office figures suggest 97% of ex-offenders comply with it. In America, the more public Megan's Law has reportedly achieved a compliance rate of just 85%.

Bolder proposals are also under discussion. One ex-offenders' organisation and some unexpected voices on the left have called for indefinite custody for that category of child molester which seems driven by a near-irresistible urge to abuse children. Chemical castration to remove the impulse is the most extreme solution; permanent confinement for those deemed still to pose a threat is another. Either way, a debate is what is needed now, not a return to vigilantism - whether in Portsmouth or on the pages of the News of the World.