The riots that erupted in London a year ago caught the police off guard.

However, as The Herald reports today, officers are less likely to be taken by surprise again, thanks to the implementation of sophisticated software for the monitoring and analysis of social media sites. As well as identifying and tracking potential troublemakers, the new technology has the capacity to gauge public mood by analysing patterns and trends in millions of tweets and Facebook postings.

Should we welcome this as a logical advance in police intelligence gathering or worry about threats to our digital freedom? Both, perhaps.

It may seem self-evident that the internet and social media have dramatically extended freedom of speech. Billions can now receive, comment, share and send information in a way that was unimaginable until recently. Twitter and email have nourished the pro-democracy movement.

Yet the very scale of social media communication contains threats as well as opportunities. One of the biggest threats comes from the ability to collect colossal amounts of personal information through Twitter and Facebook accounts. Yet, while there is a debate about how companies such as Google and Facebook stockpile and use personal information and concern about the way it enables authoritarian regimes, such as China and Iran, to spy on their own citizens, there is less questioning about how our own Government and police use such technology to snoop on us. In the UK, this process will be facilitated by the Communications Data Bill currently going through Parliament.

As Theresa May told the Commons recently, if police ignore changes in technology, they will be "fighting crime with one hand tied behind their backs". Social media may spread liberty, democracy, friendship and handy information but they are used by others for nefarious purposes. Once foot patrols were used to gauge the mood of unrest on the streets. Now that so much communication is online, it makes sense for police officers to patrol the information superhighway, as well as city streets.

It is easy to see how such technology could help assess the likelihood of street riots but anticipating when a situation is about to turn ugly always will be an inexact science. In the case of last summer's riots, there were certainly underlying tensions between the public and the police in Tottenham but nobody could have anticipated the way the mishandling of the shooting by police of Mark Duggan would be the spark that lit an inferno.

Also, the power created by such a new tool must be handled responsibly. This is not so much about how the police gather information as what they do with it. Any reference to "anticipating" crime should ring alarm bells. This is the stuff of dystopian Orwellian nightmares about "thought crime".

How and at what point should police act when no actual crime has been committed? Is it appropriate for police to trawl social networking sites to pre-empt school leavers from organising post-exam parties? And are so-called internet trolls who make obnoxious or racist remarks from behind a cloak of anonymity much different from drunks raving on street corners? There is a serious human rights issue here. Harvesting information from Twitter and Facebook is a potentially useful tool in keeping us safe but we ignore the darker side of such power at our peril.