LIKE most people concerned about freedom of speech, I've been watching the progress of the Offensive Behaviour at Football and Threatening Communications Bill with mounting alarm.

Outlawing the singing of songs at football matches seemed such a ridiculous proposition that initially I thought the Scottish Government weren't serious. That Alex Salmond just wanted to "send a message", and that the loopier parts of this unnecessary legislation would be dropped. And if not, MSPs would realise that such a law is as unworkable as it is objectionable. Surely, reason would prevail. It hasn't.

Yesterday, MSPs in Holyrood passed a law that could make the singing of the national anthem punishable by a five-year prison sentence if it is associated with "offensive or threatening behaviour" in any context that involves football. No-one knows exactly what "offensive and threatening behaviour" is, and anyway, because of the Catch-22 drafting, the very singing of "sectarian" songs is itself deemed offensive. There is no list of proscribed songs because to compile one would invite ridicule – Give Ireland Back to the Irish – Paul McCartney? This dumb law could also make the carrying of flags, colours or religious symbols illegal at football matches, in the trains going to football matches or in pubs or any public place where football is being shown. It could make singing The Sash illegal in a pub, but not in the street outside it. This is utter madness.

Anyway, there are worse things than singing Up the 'Ra at a football match. Using the law for political purposes is one of them. This legislation is otiose, contradictory, authoritarian, subjective, illiberal, anti-democratic and contrary to internationally accepted definitions of basic human rights. It is threatening and offensive to freedom of speech, freedom of association, freedom of thought and to personal liberty. It hands discretionary powers to the police that are wholly inappropraite in any civilised society, effectively giving individual officers the power to deprive people of their liberty if they don't like the way they are behaving.

It also offends against the most fundamental principle of the law: that there should be equality before it. The singing of Flower of Scotland, for example, which celebrates violent behaviour against English people, will be illegal at Hampden but not at Murrayfield simply because they play rugby there. Why on earth should a song be offensive at one sporting event and not another? And don't tell me that people don't engage in offensive and threatening behaviour at rugby matches. Just look at what happens on the pitch.

Behaviour liable to lead to public disorder is already illegal. Section 38 of the Criminal Justice Act 2010 outlaws "threatening or abusive" behaviour "likely to cause a reasonable person to suffer fear or alarm". The Offensive Behaviour Bill takes the law into an entirely different realm altogether, into subjective hate crime. It will criminalise thought and behaviour that other groups might find offensive. Well, someone should tell the FM and his MSP clones that the right to offend people is the most basic right in any democracy.

Now that this law will be applied in football stadiums, there will inevitably be pressure to extend it to workplaces, public spaces, parks, meetings, concert halls, theatres, cinemas. schools – indeed anywhere where "offensive" ideas might be ventilated. For if they are illegal in one public setting how can they possibly be legal in another? How could films like Michael Collins, about the IRA leader, be shown in Glasgow cinemas? Should Scottish Nationalists be allowed to chant the bloody anti-English dirge, Scots Wha Hae, at Bannockburn? That's threatening and offensive. The Edinburgh Festival Fringe will become a playground for litigants claiming to be offended and threatened by productions like Singing I'm No A Billy I'm a Tim.

The Government has tagged a feeble "freedom of speech" clause to the Bill which only underlines the extent to which this is in violation of it. The Lord Advocate insists that jokes and satire will not be actionable. But who is to decide? The law has a notoriously tin ear when it comes to irony, and is incapable of distinguishing between banter and abuse. Yet now, calling someone a "Hun", a "Fenian" or a "bluenose" could lead to imprisonment and a hefty fine if the words are uttered while footie is on the TV. Well, if my experience is anything to go by the police will be prosecuting workplaces and homes throughout Scotland. One of the ways in which people have sought to defuse sectarianism is by lampooning it, parodying it, satirising it. Many Celtic supporters call themselves Tims. Are they now to be prosecuted if someone overhearing these remarks feels threatened? Pity the publicans who are required to enforce this nonsense.

Worse, the Government has attempted to curb freedom of speech on the internet by saying that "threatening communications" will also be punishable by five years in jail.

Leave aside the virtual impossibility of enforcing this law on social media sites like Facebook which has 800 million users, who on earth is to rule what is and is not threatening?

Two years ago, Paul Chambers, a 27-year-old accountant, lost his job and was fined thousands of pounds for a joke tweet that read: "Robin Hood airport is closed. You've got a week and a bit to get your s*** together otherwise I'm blowing the airport sky high!!". Alex is going to have to hire a lot more police. No wonder they're about the only people who support it.

This is an unjust law which has been criticised by almost every legal body that has reviewed it. It has achieved the impossible: uniting Rangers and Celtic, the Church of Scotland and the Church of Rome, lawyers, civil liberties organisations, the Conservative Party and the Greens – in opposition to it.

It has been frog-marched through Parliament by an act of elective dictatorship. This is Alex Salmond's first own goal, if you'll excuse the pun. He should have listened to Parliament and dumped it last summer when he had the chance. The only hope now is that courts and juries will treat it with the contempt it deserves.