Social media has been a significant part of life now for a nearly decade, yet there are still too many instances of wrongdoing online not being tackled when it would be firmly dealt with if it occurred in the street, pub or school playground.

The racial abuse endured on Twitter by Glasgow SNP councillor Feargal Dalton, is a case in point. A series of tweets referred to Mr Dalton as "Paddy" and accused him of glorifying terrorism. Police took up the case but informed Mr Dalton that their investigation could not proceed because Twitter was refusing to divulge details of who owns the account from which the offensive tweets were sent.

In general, a careful balance must be struck where social media is concerned between upholding freedom of speech and cracking down on abuse, but there appears to be a strong case for Twitter to hand over the requested information on this occasion. Abuse that is aggravated by racial or religious prejudice carries a higher sentence under Scottish law and the Crown Office rightly takes such offences very seriously. It is quite right that crimes aggravated by hatred on the basis of religion, race, gender, disability or sexual orientation should carry tough penalties; that development in Scots Law is enlightened. No action can be taken at all, however, if details of the perpetrator are being withheld from investigating officers.

Mass online social media organisations such as Twitter have become fearsomely wealthy and powerful in recent years, but alongside making money, they bear significant responsibility to the societies in which they operate worldwide.

Facebook, the world's biggest social networking site, has had to tighten its rules in the last year, vowing to remove content that celebrates violence and earlier this year, removing certain posts relating to guns. A strictly hands-off policy would clearly have been wholly irresponsible, after Facebook users were found to have been sharing video clips of beheadings and trying to sell illegal guns through the site or sell weapons without requiring background checks.

Twitter itself has made efforts in recent days to suspend the accounts of those sharing images of the death of the journalist James Foley by decapitation. It clearly recognises that freedom of speech has to be exercised responsibly. By that token, it should also be prepared to disclose details of clients where the police deem there is a case to investigate.

Mass-use social media sites where there are millions of posts every hour clearly do not lend themselves to pre-vetting of content before it is uploaded, but it ought to be a relatively simple matter, once a legitimate objection has been raised about a post or posts, to remove them and cooperate with police in any investigation. If Twitter is not willing to do this, it must explain why not.

The hope now must be that Twitter sees sense and cooperates with this police investigation so that the individual who left these messages online cannot hide any more behind the mask of anonymity.