Like him or loathe him, the jailing of Tommy Robinson for contempt of court was an event of legitimate press and public interest. It cannot be right, whatever else, that a British citizen can be deprived of their liberty “in the dark”, the very fact of their whereabouts made a secret. It feels wrong, and, in spirit at least, partly in breach of the ancient principle of habeas corpus.

The answer to the question “Where’s Tommy?” cannot be: “We know but we cannot tell you because a court says so.” Besides, social media is wild enough to make that impossible, anyway.

As the old adage goes, justice should be done and seen to be done. That is why The Independent chose to challenge the situation. In Robinson’s case it cannot be said that, until the intervention of The Independent and Leeds Live, justice was being properly seen to be done, and the whole thing was getting farcical. Now justice has been seen to be done, to the extent that it can be.

Robinson, who co-founded the English Defence League and whose real name of Stephen Yaxley-Lennon has been listed on the court documents, was jailed for a specific offence connected with a Facebook Live broadcast. As a matter of fact, he admitted contempt of court through publishing information that could prejudice a current trial. Whatever that trial was about, it, like all other legal processes, should not be undermined or derailed completely by the activities of one or more people seeking publicity, pursuing some cause of their own or simply causing mischief. Justice is too important for that, and it is right that those held in contempt of court should suffer the consequences. That is the point of having contempt laws.

The 13-month sentence handed down, in circumstances that can still not be fully disclosed by the media because that would merely repeat the original contempt, appears justified and proportionate. Robinson was already subject to a suspended sentence for committing contempt during a rape trial in Canterbury last year, and had been told that if he fell afoul of the law again he would go to prison.

The wider question that this episode raises is the future (and present) viability of contempt laws in an era when social media and the internet can be so easily and rapidly deployed to the detriment of justice and a fair trial. Tweets can be tweeted and web broadcasts made before anyone in authority even realises they are out there. That is a fresh challenge with which, as we see in the case of Robinson, the law cannot easily cope. If the contempt laws are not workable, they will fall into contempt themselves, in the more colloquial sense of the phrase.

Far-right protesters descend on Whitehall after Tommy Robinson arrested for 'breaching the peace'

There are reasons why people on trial – and indeed the victims, who will be deprived of justice if a trial is forced to be abandoned – are protected in this way. Those reasons have not altered simply because the technology has moved on. What is urgently required is for the Ministry of Justice, or rather its political chiefs, to attempt to bring the law itself up to date, to clarify procedures for judges caught up in difficulties of this kind, and to try and find some method of encouraging the social media giants to cooperate.

There is already a lively debate about whether some organisations are “publishers” of news and “content” or mere “aggregators”, with differing rights and responsibilities flowing from that. The government is presently reviewing that new media landscape. Ministers might also usefully extend that review to the specifics of the reporting of legal proceedings, and especially when it takes place in “real time” and within the precincts of a court.

As is so often the case with attempts to restrict information in the modern age, these are often only partially successful. Rumours abound across social media, and not every citizen has equal access to know about what has been happening in the courts simply because not everyone has an account on Twitter or Facebook.

The fact is that social media is sufficiently beyond the law and anonymous that much damage can already be done to a trial through contempt of court proceedings. It is also true, though, that that damage and knowledge, though widespread, is not universal. So a line has to be drawn somewhere on the contempt laws that takes realistic account of these new realties.