Another day, another example of how our police and judiciary are criminalising nastiness. Today a young Muslim man who is angry at the UK's involvement in the ongoing Afghanistan conflict was sentenced for posting angry comments on Facebook stating that British soldiers “should die and go to hell”. Not exactly the nicest of sentiments, but is it really something we should be criminally prosecuting through the courts?

Azhar Ahmed, from Dewsbury, Yorkshire, escaped jail partially because he quickly took down his unpleasant posting and tried to apologise to those he offended. But he will still have to carry out 240 hours community service after he was convicted under section 127 of the Communications Act 2003 for making “grossly offensive comments”.

His sentence came just 24 hours after a 20-year-old Matthew Woods from Lancashire was given three months in jail for posting ill-timed and very unpleasant jokes online about the missing schoolgirl April Jones.

Stupidity

By the looks of it neither Woods nor Ahmed are amiable or eloquent people. But that doesn't mean we should be locking them up or giving them criminal records for the stupid things they say.

Of course free speech isn't wholly free. That's why we have laws banning incitement to violence or encouraging hatred based solely on something a victim cannot change such as their religion, disability or sexual preference.

But in recent years we have increasingly begun to criminalise the offensive, a precedent that should be deeply worrying for anyone who cares about the importance of free speech. It's problematic because offence – like art, music, comedy or food – is inherently subjective. What one person finds outrageous or disgusting might be hilarious, harmless or tasty to another.

Free speech is not just the right to say nice things to people. It is also the right to be nasty, unpleasant, boring, unfunny and stupid. If you start to criminalise the offensive, you pave the way for both real and self-censorship.

It's worth taking a look at exactly what Ahmad said to earn his conviction. Two days after six British soldiers were killed by an improvised explosive device in March he wrote on Facebook:

“People gassin [venting off] about the deaths of soldiers! What about the innocent familys who have been brutally killed.. The women who have been raped.. The children who have been sliced up..! Your enemy’s were the Taliban not innocent harmless familys. All soldiers should DIE & go to HELL! THE LOWLIFE F*****N SCUM! gotta problem go cry at your soliders grave & wish him hell because that where he is going.”

Criminal?

It's neither pleasant, nor eloquent. But criminal? There are plenty of people up and down the country – Muslim and non-Muslim alike – who are deeply uncomfortable about Britain's foreign policy and its military operations in predominantly Islamic countries. They have a right to be heard and speak out. We might not like what they have to say – or even how they say it – but we shouldn't be shutting them down.

In sentencing Ahmed, District Judge Jane Goodwin insisted she was not stopping legitimate political opinions being strongly voices. Instead, she said, the test is whether what something which has been written or said is “beyond the pale of what's tolerable in our society”.

That's a very slippery slope because what society finds tolerable at any given time changes or evolves. It was only a little more than a century ago that giving women the right to vote was beyond the pale of what society found tolerable.

At the moment there is something sacrosanct about our armed forces. Over the years we have been traumatised by the steady trickle of coffins and injured veterans ferried back from theatres of war in Iraq and Afghanistan. Many of us want to pay tribute to our armed forces. So we are sensitive to criticism of “our boys”, especially if those attacks come from British Muslims.

But our soldiers mustn't be above criticism especially given that – unlike in some previous twentieth century conflicts Britain fought in – those going to war are volunteers, not conscripts. Like it or not our wars of the last decade have proven deeply unpopular among a large section of the population, not to mention the soldiers fighting them.

The sad fact it that whilst trying to defend Britain from the genuine threat of violent Islamism, British personnel have killed and maimed innocent Muslims. When the rights and wrongs of our wars are debated the conversation is inevitably emotional. People say things in the heat of the moment that are unpleasant, even offensive. But should it be criminal?

Democracy

Many American soldiers returning from Vietnam might have been horrified by what they felt were “grossly offensive comments” made to them about the rights and wrongs of the Washington's military engagements in South-East Asia. But challenging, radical, even offensive remarks were all part and parcel of the democracy they were supposedly trying to protect.

Defending Woods and Ahmed, however unpleasant or ineloquent they are, is necessary because of the wider ramifications that their prosecutions have on free speech and the broad way in which section 127 of Communications Act and section five of the Public Order Act are being used to criminalise the offensive or unpleasant.

How long before comedians are arrested for making a joke pegged to a recent tragic event which is – so the joke goes - “too soon”? How long before pub arguments are broken up by flashing blue lights after someone says something “beyond the pale”? How long before the next Salman Rushdie is not protected from the mob but thrown to it?