The contrast could not have been greater.

In the streets around The Clutha pub in Glasgow, people laid flowers in tribute to the victims and, in Bute Hall, a memorial service was held for Captain David Traill, the pilot who died in the accident. Meanwhile, on the internet, a 16-year-old allegedly posted sectarian and racist comments about the crash.

If the allegation is true - the 16-year-old who allegedly made the comments was arrested last week - it will not be the first time that social networking sites have been the source of vile comments on tragic public events and it will surely not be the last. The question is: how can such comments be controlled?

There are probably two elements to the answer, cultural and legal, and they are changing at different speeds. The rate of change around the culture of the internet has been remarkable and has left some people who use it with the impression they have total free speech. As Sheriff Iona McDonald said recently in the case of Gordon Mullen, who made a series of shocking posts about the murder of April Jones, some young people in particular think it is okay to say whatever they like.

This is not the case, and should not be. Since 2003, The Communications Act, which was used to prosecute Mullen, has made it an offence to post a message online that is grossly offensive or indecent, obscene or menacing. Not only that, the internet is subject to the same laws as any other public pronouncement, whether that be in a newspaper or magazine, a public bar, or a football stadium.

This was demonstrated recently in the case of the people who named on Twitter a woman raped by footballer Ched Evans, which broke the laws preventing the victims of sex attacks being identified. The case of Sally Bercow also made it clear, if anyone was still in any doubt, that the laws of defamation apply to the internet too.

The Clutha case is being prosecuted under the 2012 Offensive Behaviour at Football and Threatening Communications (Scotland) Act because the alleged comments were of a sectarian nature, but what is most welcome is the pronouncement of the Lord Advocate on the matter. It is important, he says, that the Crown Office and the procurator-fiscal service demonstrate a robust prosecution policy towards such offences. In other words, prosecutors must take a hard line against hate crime on the internet.

Naturally, such a policy must always be balanced with the public's right to free speech, and this newspaper's reservations about the 2012 Offensive Behaviour Act are on record. However, internet users will only begin to understand what is, and what is not, acceptable if there is clear guidance from prosecutors on the matter.

The Lord Advocate has said he will issue such guidance on hate crimes linked to The Clutha this week, but he is also clearly making a statement of intent on such conduct in general and that is welcome. The internet should be a place of free expression but it should not be a place that is free from the law. Those who do not realise that should be met with a policy of zero tolerance until the culture catches up with the law.