"ADI's banned advertisement can be viewed here," says the Animal Defenders International website – neatly summing up the paradox that has split the European court of human rights.

As the court acknowledged, it is perfectly lawful for ADI to publish on YouTube a 30-second commercial, showing a child in a cage, as part of its campaign to protect great apes from exploitation ("my mate's a primate").

But the grand chamber of the European court has now decided by a bare majority of nine votes to eight that UK laws banning the commercial from being broadcast on television or radio do not breach the animal defenders' human rights.

Section 321(3) of the Communications Act 2003 brings the film into the ambit of paid political advertising, which has never been permitted on television or radio.

Both sides based their case on article 10 of the human rights convention, the right to freedom of expression. This right is qualified rather than absolute: freedom of expression is subject to such restrictions as may be "necessary in a democratic society". The case turned on the meaning of those five words.

The government's view was the ban on political advertising was necessary to avoid the risk that public debate would be distorted in the most powerful available media because those with the deepest pockets would have the loudest voices. Most campaign groups couldn't afford it.

Unregulated broadcasting of paid political advertisements would turn democratic influence into a commodity that would undermine broadcasting impartiality, the government argued. The ban was designed to enhance the political debate rather than restrict it.

ADI's view was that the ban was too wide. It was one thing to restrict party political advertising in the runup to an election. It was quite another to restrict the free expression of social advocacy groups at other times. Other media were becoming as powerful as television and yet there was no attempt to ban political advertising on the internet.

The campaign group also relied on previous rulings from the human rights court in favour of animal-protection groups that wanted to advertise on Swiss television. It was no doubt for this reason that the case was allocated to a 17-judge grand chamber, whose decision is final.

The case was heard in March last year, when Sir Nicolas Bratza was president of the court. The UK judge was required to sit but not permitted to preside. Bratza was one of the nine who voted in favour of the British government's position. If he had decided the case against the UK then, other things being equal, the government would have been required, by treaty, to introduce paid political advertising on commercial television.

Bratza's concurring opinion is therefore worth reading. He pointed out that the ban on political and religious advertising in the UK has been in force for nearly 60 years.

Bratza also explained that it is the rule itself that the court must consider, not individual cases that might cause hardship. Quoting Lord Bingham, he said "the drawing of a line inevitably means that hard cases will arise falling on the wrong side of it, but that should not be held to invalidate the rule if, judged in the round, it is beneficial" – meaning, in this context, consistent with the human rights convention.

Bratza attached considerable significance to the fact that ADI could spread its message by other means. As well as advertising elsewhere, it could take part in current affairs programmes on radio and television. If the internet was so powerful, why did ADI need to show its commercial on television?

Finally, Bratza had doubts about the Strasbourg court's previous judgments on this issue, preferring the decisions of the UK courts. His job, and that of his fellow human rights judges, was not to substitute its own view for that of parliament, he added. It was to decide whether the UK authorities had stepped outside the "margin of appreciation" – the discretion or room for manoeuvre – allowed by the human rights convention. They had not.

More broadly, the majority of the court held that the broadcast media were still powerful; that advertisers were prepared to pay much larger sums of money for television advertising than campaign groups could afford; that the ban was relaxed by giving parties free broadcasts at election times; and that changing the law could lead to abuse and arbitrariness.

Jan Creamer, the chief executive of ADI, said it was unjust that companies could use animals on television to sell products and services when ADI was not permitted to challenge them in the same medium. "This is a profoundly sad day for democracy," she added.

But the culture secretary, Maria Miller, in welcoming the decision, said the ban on paid political advertising had wide support and had helped sustain the balance of views that was at the heart of British broadcasting.

The government will be mightily relieved at this narrow victory, but I don't suppose anyone will thank Bratza, now retired, for the part he must have played in winning over other judges who might have felt inclined to provoke yet another confrontation with the UK.

I have nothing against ADI or any other lawful campaign group. I support free speech. But – like many people, I suspect – I have no wish to see US-style political advertising on television, forcing our political parties to raise ever larger funding by increasingly dubious means. The margin of appreciation is a wonderful thing and I am glad to see it has lost none of its elasticity.