There will be lots of talk of pride in Britain today, but perhaps the biggest source comes from the Royal Courts of Justice rather than the Olympic stadium. It was there, at the Court of Appeal, that justice - and sanity - finally prevailed, as Paul Chambers’ conviction of sending a message of a ‘menacing character’ was overturned by the lord chief justice.

But whilst the judgment should be welcomed - and Twitter was in jubilant mood this morning - the very fact this case advanced only serves to undermine confidence in the legal system to an increasingly cynical public. The charge related to a tweet sent in 2010 by Chambers following problems at a Doncaster airport.

The offending tweet in full: ‘Crap! Robin Hood Airport is closed. You’ve got a week and a bit to get your sh*t together otherwise I am blowing the airport sky high!’ A joke. A pretty crass joke, but a joke nonetheless. That the Crown Prosecution Service opted to hound this man for more than two years is nothing short of shameful.

Reading through the judgment, the absurdity of this case is so stark it’s easy to think Lord Judge used a few expletives of his own at having to waste his time with such a triviality. For a start, Chambers was charged under section 127(1)(a) and (3) of the Communications Act 2003 - legislation that pre-dated Twitter by four years.

The tweet itself actually remained undetected by anyone other than his 600 or so followers for five days. Only then, on a speculative search for Twitter talk about his airport, did the duty manager notice Chambers’ tweet. Duty bound to report the matter to his boss, the tweet was found to be a ‘non-credible’ threat and was passed onto the police as a matter of course.

There it should have been quietly filed away, but instead South Yorkshire police arrested Chambers at work two days later. Despite the subsequent police report stating there was ‘no evidence to suggest there is anything other than a foolish comment posted on Twitter as a joke for only his friends to see’.

But the court took the view that an ‘ordinary person seeing the tweet would see it in that way and be alarmed’ and his conviction was secured. Who are these ‘ordinary’ people? Presumably we’ve yet to see them as they’re too afraid to leave their own house.

Thankfully, in today’s judgment, we have overdue common sense. It points out that wannabe terrorists rarely use their own name to serve warnings, and often give less than a week for the authorities to plan ahead. The language, tone and lack of direct recipient all suggest this is hardly the work of a master criminal. Moreover, given that the authorities themselves were so unconcerned they left Chambers alone for a week, it hardly seems that his tweet sent panic through the staff at Robin Hood Airport.

Today, Chambers is a free man and deserves to get his life back on track.

But the matter must not end there. Public money has been wasted on this farce and confidence in the legal system eroded (not to mention making the effort to prevent terrorism that much harder). At some point, the government must create new legislation to cater for the rapidly changing world of social media.

There needs to be a public inquiry into how the CPS allowed this case to grow out of control. And on that point, I’m definitely not joking.

Follow John on Twitter