People who tweeted photos allegedly of child killer Jon Venables are being charged with contempt of court. It's the latest in a long line of cases that suggest that ordinary social media users need to have a grasp of media law.

Journalists from traditional media are used to going on courses and reading works like McNae's Essential Law for Journalists. Those regularly covering court may have another level of knowledge. But the final resort is always to the expert advice of a media lawyer.

Here are some of the categories of law on which social media users in England and Wales are coming unstuck.

Libel on Twitter

Case: Lord McAlpine falsely accused

Alleged offence: Libel

A tweet is potentially libellous if it damages someone's reputation 'in the estimate of right thinking members of society' What can and can't you say on Twitter?

Outcome: Cases against most tweeters dropped but action still being taken against Sally Bercow, wife of Commons speaker John Bercow

In November, Conservative peer Lord McAlpine announced his intention to seek libel damages from Twitter users over incorrect and defamatory insinuations linking him to child sex abuse.

The Conservative peer had already received a substantial damages settlement from the BBC over a Newsnight report falsely suggesting he was a paedophile.

Newsnight did not name him in its report, but it prompted a guessing game on Twitter which resulted in the peer being falsely accused of sex offences.

The law concerning Twitter is clear - if you make a defamatory allegation about someone you can be sued for libel. It is the same as publishing a false and damaging report in a newspaper.

But until the McAlpine case, no one had seriously attempted to exercise that right in the UK.

Twitter users may have felt a "safety in numbers", says technology law expert Luke Scanlon, of Pinsent Masons. They assumed they could say anything they liked about public figures because the public figure could not sue everybody.

Lord McAlpine has dropped threatened legal action against Twitter users with fewer than 500 followers and instructed his lawyers to concentrate their efforts on seeking £50,000 in damages from Mrs Bercow, in what is expected to be the first High Court Twitter libel trial.

At the height of the Twitter frenzy, Mrs Bercow tweeted to her 56,000 followers: "Why is Lord McAlpine trending? *innocent face*"

Tweeting in ignorance 46% of 18- to 24-year-olds are unaware they can be sued for defamation if they tweet an unsubstantiated rumour about someone, according to research for law firm Wiggin

That compares to 17% of over-65s

ComRes interviewed 2,047 British adults online from 5 to 7 December 2012

The test: A tweet is potentially libellous in England and Wales if it damages someone's reputation "in the estimation of right thinking members of society". It can do this by exposing them to "hatred, ridicule or contempt". It is a civil offence so you won't be jailed but you could end up with a large damages bill. The rules also apply to re-tweets.

The best defence is if you can prove the contents of the tweet are true.

You could also claim it was "fair comment" - your honestly held opinion on established facts. Another possible defence is to claim you were covered by privilege, if it was something said in Parliament or in court, or that it was an example of "innocent dissemination" - you did not know you had published the comment (it might have been an automatic system).

The only way to be completely safe is to avoid tweeting gossip unless you know for a fact that it is true.

How it's changing: Under the Defamation Bill, due to become law later this year, litigants in England and Wales will have to show that the words they are complaining about caused "substantial harm" rather than simply "harm" to their reputations.

Website operators may also be forced to remove potentially libellous comments by anonymous "trolls" or hand over their names and addresses to the authorities. Scotland is expected to adopt its own version of the changes.

Reporting sex offences

The case: Twitter users name the victim of rape by footballer Ched Evans

Offence: The Sexual Offences (Amendment) Act 1992

Outcome: Seven men and two women fined by Welsh magistrates

Wales footballer Ched Evans was convicted of raping the 19-year-old woman in April 2012. The case generated more than 6,000 tweets, with some people deciding to name the victim, suggesting she was "crying rape" and "money-grabbing".

All of those who pleaded guilty and were fined said that they did not realise they had broken the law by naming her.

The test: Media organisations are automatically banned from naming the victim of sexual assaults. The same rules apply to social media users.

How it's changing: It's not

Breaking a court order

The case: Social media users circulate alleged pictures of child killer Jon Venables

Alleged offence: Contempt of court

Possible outcome: Fine or imprisonment

Still maintain was not a libellous tweet - just foolish Sally Bercow after apologising to Lord McAlpine

The attorney general is taking legal action against several people who published photographs said to show one of James Bulger's killers. There is a ban on publishing anything revealing the identity of Jon Venables or Robert Thompson.

Images said to show one of them as they are now appeared online earlier in February, and have since been removed. Venables and Thompson were convicted of killing two-year-old James in Merseyside in 1993.

In extremely rare cases, often involving child killers, a judge will make an order banning their identification to protect them from vigilante attacks and allow them to start a new life under a new identity.

The test: The social media users facing prosecution are accused of breaking the terms of a court injunction banning the identification of Venables and Thompson. The terms of the order mean that if a picture claims to be of Venables or Thompson, even if it is not actually them, there will be a breach of the order.

How it's changing: It isn't

Other contempt of court

The case: Juror Joanne Fraill contacts defendant in trial by Facebook

Offence: Contempt of court

Outcome: Fraill is jailed for eight months

In June 2011, 40-year-old Fraill became the first juror to be jailed for contempt over social media after she caused the collapse of a multi-million pound drugs trial after exchanging messages with a defendant.

Sentencing Fraill, the judge at London's High Court said in a written ruling: "Her conduct in visiting the internet repeatedly was directly contrary to her oath as a juror, and her contact with the acquitted defendant, as well as her repeated searches on the internet, constituted flagrant breaches of the orders made by the judge for the proper conduct of the trial."

The test: The main aim of contempt rules is to ensure fair trials by limiting juries' exposure to information that might be prejudicial. Jurors are meant to make up their minds on the evidence presented to them in court, not what they have seen in the media.

How it's changing: The Law Commission believes a new criminal offence will have to be created to prevent jurors looking up information about a case online or chatting about it on social media. The government is due to legislate.

Threats

The case: Paul Chambers joked on Twitter that he would blow up Robin Hood Airport

Offence: Sending a "menacing electronic communication" under the 2003 Communications Act

Outcome: Found guilty in May 2010 but conviction quashed on appeal

Now people can have a joke even if it's a bad joke John Cooper QC, who represented Chambers

Paul Chambers was living in Doncaster, South Yorkshire, when he joked on Twitter that he would blow up nearby Robin Hood Airport when it closed after heavy snow - potentially disrupting his travel plans.

He tweeted: "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 conviction was eventually quashed by the High Court, amid a high profile campaign to defend free speech on Twitter.

The test: It can come down to the judgement of police and prosecutors. Aggravating factors, such as racism and prejudice against religion, disability and sexual orientation will lead to increased sentences.

How it's changing: The Chambers case appears to have been a turning point. Prosecutors have been urged to consider whether a threat to damage property or harm someone carries real menace before pushing ahead with a case.

"As a general rule, threats which are not credible should not be prosecuted, unless they form part of a campaign of harassment specifically targeting an individual within the meaning of the Protection from Harassment Act 1997," say the new CPS guidelines.

Offensive comments

The case: Reading man Sean Duffy mocks dead children on social media sites

Offence: Making "grossly offensive" comments under the Malicious Communications Act 1988

Outcome: Duffy was jailed for 18 weeks in September 2011

Previously in the Magazine Trolling is a phenomenon that has swept across websites in recent years. Online forums, Facebook pages and newspaper comment forms are bombarded with insults, provocations or threats. Supporters argue it's about humour, mischief and freedom of speech. But for many the ferocity and personal nature of the abuse verges on hate speech. But trolling is a broad term, taking in everything from a cheeky provocation to violent threats. It is usually carried out by young adult males for amusement, boredom and revenge, says Prof Mark Griffiths, of the International Gaming Research Unit. Trolling: Who does it and why? Richard Bacon: My battle with the trolls

Duffy admitted posting images on Facebook and YouTube mocking the deaths of four children, including 15-year-old Natasha MacBryde who committed suicide.

The case made legal history in England and Wales - but others have since found themselves in court for making offensive comments or expressing views that are likely to upset people, prompting concern that free speech is being restricted.

The right to be rude about someone in print is protected in English law. "Vulgar abuse" is not considered defamatory. Article 10 of the European Convention on Human Rights also protects free speech.

Duffy was prosecuted under a piece of legislation originally designed to combat hate mail and nuisance phone calls.

The test: The decision to arrest and charge someone for making abusive comments is a subjective one to some extent. It depends on the police or prosecutor's interpretation of the law.

How it's changing: The Crown Prosecution Service has issued new guidelines in an effort to reduce what it sees as the alarming number of cases coming before the courts.

"Just because the content expressed in the communication is in bad taste, controversial or unpopular, and may cause offence to individuals or a specific community, this is not in itself sufficient reason to engage the criminal law," say the new CPS rules.

Tweeters can avoid prosecution if they rapidly withdraw a grossly offensive comment, express "genuine remorse" for it, or if the comment was not intended to be widely distributed in the first place.

Those aged under 18, who "may not appreciate the potential harm and seriousness of their communication," are also unlikely to be hauled before the courts.

Injunctions and super-injunctions

The case: 75,000 people name Ryan Giggs on Twitter as footballer at centre of injunction row

Offence: Contempt of court

The outcome: The judge declined to renew Giggs' injunction banning details of an extramarital affair being published. No action was taken against the Twitter users

Individuals can take out injunctions to prevent publication of potentially damaging material. A super-injunction prevents the media from reporting even the existence of an injunction.

They were first used to protect the safety of notorious criminals when they were released from jail. In recent years they have been taken out by celebrities to stop the tabloid press exposing their private life.

Judges have to be convinced a newspaper is ready to publish highly intimate information and that the applicant, however famous, has a right to privacy.

But critics say they have a devastating impact on free speech.

The test: Media organisations or social media users potentially face prosecution for contempt of court if they report the identity of a person who has obtained a super-injunction.

How it's changing: Since the controversy over Ryan Giggs and other well-known figures taking out super-injunctions, many have now been lifted.

The government has also instructed judges to "time-limit" new ones. But a number of privacy orders are still thought to be in force.

Other offences

A total of 653 people faced criminal charges in England and Wales last year in connection with comments on Twitter or Facebook.

These divided into offences committed on the two sites, such as posting abusive messages, and those which had been provoked by messages, including violent attacks.

Many of the offences, such as harassment or threats to kill would have been committed, albeit in a different way, before social media was invented.

Scotland

Scotland has a different legal system to England and Wales, but the same principles broadly apply when it comes to defamation and contempt.

The terminology is different - in England and Wales defamation is split into libel, which applies to the written word, and slander, which applies to spoken words. In Scotland it is all called defamation.

The statute of limitations is also different. In England and Wales you can only be sued within a year of the potentially libellous tweet being published.

In Scotland, you can be sued for up to three years after publication. The Defamation Bill, due to become law in England and Wales later this year, will not apply to Scotland. The Scottish government has said it will make its own reforms in due course.

But leading Scottish media lawyer Campbell Deane says that if Scotland retains its three year limit and does not make other changes to stay in line with English law, there could be more cases of "libel tourism" with residents of England seeking compensation in the Scottish courts.

You can follow the Magazine on Twitter and on Facebook