For many they are the scourge of the Internet, but rights campaigners in Britain are increasingly leaping to the defence of online "trolls" amid a string of criminal trials over tweets and Facebook posts.

Prosecutors are to revamp their approach to cases involving social media following an outcry over freedom of speech, after "offensive" online comments from bad jokes to homophobic insults resulted in arrests and even jail.

A 19-year-old man was handed three months in prison on Monday after posting crude jokes on Facebook about a missing five-year-old thought to have been murdered in Wales.

Matthew Woods' comments prompted an angry mob to gather at his home, and he was initially arrested "for his own safety".

But many contrasted his jail time with a community sentence handed on the same day to a TV comedian, Justin Lee Collins, who was found guilty of a campaign of abuse of his girlfriend, in which social media was not involved.

"People post sick, offensive, horrible and stupid things on social media all of the time... As a society we should try to make people nicer, cleverer and less offensive. But is sending people to prison, along with violent rapists and thugs, the right way to do it?" questioned Adam Wagner, a blogger on legal issues.

Woods' case follows that of Azhar Ahmed, 19, sentenced to community service for declaring on Facebook that "all soldiers should die and go to hell".

"I think we have seen some very clearly unjust prosecutions," Padraig Reidy, news editor at campaign group Index on Censorship, told AFP.

But he added: "We need to find a balance. There's no doubt people can be harassed or menaced quite horribly on social media."

Finance worker Paul Chambers, 28, has become a poster boy for the freedom of speech argument since he tweeted in 2010: "Crap! Robin Hood airport is closed. You've got a week and a bit to get your shit together otherwise I'm blowing the airport sky high!!"

His tweet -- sent in frustration at the airport in Nottingham because he feared he might miss a visit to his girlfriend --- led to his arrest and a criminal conviction for sending a menacing message, in one of the first cases of its kind.

Chambers fought a legal battle lasting more than two years to overturn the conviction, winning huge online support in what became known as the "Twitter joke trial". It was finally quashed in July.

Reidy said of the case: "The important thing with the eventual ruling is that the court found people do have a right to be hyperbolic, insulting and maybe offensive online. That in itself should not constitute a crime."

But more prosecutions were being brought under communications and public order laws dating from before Twitter existed.

In particular, the Communications Act 2003 -- used for many of the cases -- has come into question. It prohibits "the sending to another of any article which is indecent or grossly offensive, or which conveys a threat".

"In 2003, only perhaps (Facebook founder) Mark Zuckerberg knew that within the next few years literally billions of people would become mini-publishers on a public communications network," wrote Wagner.

Courts have also dealt with concerted campaigns of online harassment, while fresh legal ground was broken in cases of incitement, contempt of court and libel on social media.

But it was the arrests over offensive social media posts that prompted a rethink by prosecutors.

On September 20, the Crown Prosecution Service (CPS) threw out the case of a man who posted a homophobic tweet about British diver Tom Daley during the Olympics, and said it would hold a consultation before issuing new guidelines.

It hinted some cases might have gone too far.

"If the fundamental right to free speech is to be respected, the threshold for criminal prosecution has to be a high one and a prosecution has to be required in the public interest," director of public prosecutions Keir Starmer said.

Guidelines are expected next year, but experts stress it is also a case of social media users gaining more understanding of how the networks function.

Twitter has existed since 2006, but was initially a niche medium; now it has 10 million users in Britain alone.

Legal commentator Joshua Rozenberg told AFP that in the Daly case, "the problem was that this guy didn't really grasp what the nature of a tweet was and is, and a lot of people don't.

"A tweet is not an email, it's a broadcast. When people send what they think of as a message to 100 friends, that's then completely outside of their control -- it can be forwarded to and read by millions."

But for the high court judges in the Twitter joke trial, the crux of the matter was that social networks could have either function.

"'Tweets' include expressions of opinion, assertions of fact, gossip, jokes (bad ones as well as good ones)... For some users, at any rate, it represents no more and no less than conversation without speech," they said.