Mass vigilantism against known sex offenders is dramatically back in the news.

A notorious rapist faced two big protest marches – the second by 600 people from Bonnyrigg – to his isolated cottage near the village. Police had to erect barricades to halt the angry crowd. Some campaigners have camped nearby, vowing to stay until he goes.

Robert Greens, known as the "Da Vinci Rapist", brutally raped a 19-year-old Dutch student near Rosslyn Chapel, which is featured in Dan Brown's book The Da Vinci Code, in 2005.

After his recent release from prison, local agencies had a responsibility by law to manage and rehouse him, since he was from Midlothian. The agencies include Midlothian Council, Lothian and Borders Police and NHS Lothian.

A Facebook group demanding that Greens be moved from Midlothian now has more than 12,000 members. Campaigners have also held talks over refusing to pay rent or council tax to Midlothian Council if Greens is not moved. Some have even protested directly to the Scottish Justice Secretary Kenny McAskill.

However, it is not a logical solution for any community to demand unthinkingly that dangerous offenders simply be shunted somewhere else. That simply puts other innocent people at risk, since sex offenders can operate anywhere. Other local authorities can refuse (and have refused) to house offenders themselves instead.

At the same time, many communities have little faith in the authorities to protect them from known sex offenders. Are there any constructive ways through this kind of impasse?

Unfortunately, we know from adult survivors that known or convicted sex offenders (currently more than 3000 are on the sex offenders' register in Scotland) are a tiny percentage of all abusers. These exist in each town and village, in each street and often in people's own homes. Vigilantism easily substitutes for vigilance about that much greater problem.

One reason for aggressive vigilantism against known abusers is that activists have often experienced sexual abuse themselves, or their partners or family have. But most victims fear to name their own abusers to police – through deep shame, intimidation, hostile reaction from their families or fear of an unsympathetic court process.

Thus, rage against the few known perpetrators (like violence against "nonces" in jail) becomes a safe form of projection. But it's more important that victims are helped to report people who have long been dangerous in their own neighbourhoods.

Thus, for instance, when mass DNA testing after a rape in one small Highland village trapped an elderly man, only then did women come forward to tell police he had abused them as children. He may have abused numerous others, yet for decades no-one had felt able to speak out to protect their own community.

What can be done when vigilantism erupts? One answer is to act promptly at the precise time when communities (in Bonnyrigg, or anywhere else) are feeling most threatened: building on their genuine fears for children to construct a positive, safer future for those communities.

When knowledge of a convicted sex offender's identity has already become known, local people should be invited to be involved in a positive instead of negative way. No authorities, however careful, can watch offenders all the time.

Local people can invaluably help to notice any worrying behaviour by the offender and report it. But that must go along with very clear penalties for any violence towards him or his property.

When we can anonymously report even relative trivia such as fly-tipping, we also badly need well-publicised means of anonymously reporting perpetrators of sex assault. Which, after all, is more important and urgent?

We also need "third-party" reporting via local or national voluntary sector organisations, just as we have for race and homophobic crime. More publicity about the "Moorov doctrine" (when corroboration can come from other victims alleging similar circumstances) may also assist adults to report rapists and abusers.

We need to launch and evaluate a range of community prevention projects against sexual crime, in which young people and adults are constructively involved, creating a genuinely informed, aware community working with, not against, statutory and voluntary agencies. There are some excellent examples of these "public health" models in the US, yet very few in Britain (for example, those run by the Stop it Now! organisation).

Instead expensive crisis-management is the norm. That goes along with – for authorities –fear of sex offenders breaking their conditions or of violent communities lynching their charges, and, for communities, a deep suspicion of officials, loathing of known offenders, and an unhealthy dose of projection by victims, still unable to name the predators in their midst.

Dr Sarah Nelson of the University of Edinburgh specialises in research in childhood sexual abuse and its effects on children and adults.