TO the best of my knowledge, in more than 500 years of justice in Scotland’s courts, this was the first time a judge has been invited to contemplate the immortal question of “what is a w***hole?” Mind you, you never know: mysterious things have gone on in Airdrie over the years.

I can’t help but wonder what must have been going through Sheriff Nigel Ross’s mind, sitting high on the bench, when the pro-independence blogger gave the court the benefit of his definition from the witness box. A w***hole, he suggested, was “a hole into which one might w***”. Even by the often unreal standards of the average defamation case, this was psychedelic.

Most judges are worldly people. All of human life traipses through the dismal portals of the sheriff court. F-ing and blinding in evidence is commonplace.

But Ross’s wigged head must have been contemplating what he’d done to draw the shortest straw in the judicial robing room, as Kezia Dugdale’s QC took Stuart Campbell through some of his more lurid and abrasive Twitter exchanges. It was a surreal moment. But it neatly captures a major strand of the Labour MSP’s multi-pronged defence strategy.

During the case, my phone was like a bumblebee on crystal meth. The constant buzz? Who’s going to win, Dugdale or Campbell? It is a thankless task being a resident legal sage, particularly in predicting the outcome of a case with so many pitfalls either side could tumble into.

My consistent – but not particularly courageous – legal prophecy was that it was difficult to call the case with any confidence. As I always say, law isn’t a big book of rules mechanically applied. This is doubly true of the law of defamation in this country. There were several ways for either Kezia Dugdale and Wings Over Scotland to win, lose, or win and lose their respective cases. The judgment this week – and confusion surrounding it – reflects that complexity.

It is important to understand that defamation cases aren’t wars won in single battles. They’re a complex string of skirmishes, at the end of which one side comes out on top, with a complex interaction between the merits of the claim, the string of defences which are available and the quantification of damages.

In the aftermath of the judgment, advocates and apologists for both Dugdale and Campbell have been bickering about who earned the real win in this case. Any fair-minded summary of the judgment must recognise that both sides won and lost important points in the judgment – but Dugdale walked out of the Sheriff Court with the legal win.

At the start of the case, my best guess was that Campbell would win the defamation point – Dugdale’s Daily Record argument falsely accused him of “spouting homophobic abuse” – but when it came to the quantification of damages, Wings Over Scotland would be left with peppercorn compensation rather than the £25,000 he was seeking. I was, at best, half right.

Several of Dugdale’s arguments seemed hopelessly implausible, but this is how defamation cases run. I call this blunderbuss litigation. You load every stray bullet, nail and argument into your case, in the hope that one of them hits the mark with the judge when you pull the trigger. The conflation of homophobia and transphobia was an obvious red herring. So too were Dugdale’s efforts to suggest her article didn’t really imply Campbell was a homophobe. Defamation law is rigged to recognise innuendo. I don’t have to spell the defamation out, if the ordinary reader would take the nudge and the wink.

But Dugdale did better than I expected, persuading Sheriff Ross that her article reflected a “genuine perception that the tweet represented an insult to homosexual people, and was homophobic”. Her comments were protected by the “fair comment” defence.

The title “fair comment” is a bit of a misnomer. The defence is really about honest opinion. If the defender can persuade the court that their comments were honestly held opinion about a matter of public interest, no liability in defamation arises. Dugdale did so.

But Sheriff Ross accepted too that Dugdale’s comments were “incorrect and defamatory” of Campbell, who he held is not a homophobe and doesn’t spout homophobic abuse, and whose tweet about Oliver Mundell’s turgid speaking style was not homophobic. These findings represent a significant vindication of Mr Campbell’s position.

Defamation actions are ultimately about one thing – compensation for reputational losses. Whether or not the former Scottish Labour leader defamed the blogger in her Daily Record article, whether or not Kezia Dugdale’s comments were her honest opinion about Wings Over Scotland’s activities on Twitter, if she could persuade the court that here stands a man with no real reputation to defend, any award of damages will be assessed in peanuts rather than pounds. Kezia Dugdale was the defender in this case – but the value of Stuart Campbell’s reputation was also on trial.

You can understand why Dugdale’s silk, Roddy Dunlop QC, made this tactical call. None of the comments Campbell was taken through on the stand were calculated to warm the average judicial heart to the pursuer. Dunlop characterised the blogger as a man with “no reputation to protect, a master of calumny who was happy to be known as unpleasant, abusive and derogatory”.

The judge rejected that extreme position – but Roddy Dunlop’s w***hole tour of Campbell’s Twitter feed was not in vain. Even if Dugdale hadn’t been able to avail herself of the fair comment defence, Sheriff Ross would have awarded just £100 in compensation, rather than the £25,000 sought. Points, here, to Dugdale.

Judgment in hand, we are left with the outstanding – but hugely important – question of expenses. Who pays for all the court days and the squadrons of lawyers on both sides? At the close of his judgment, Sheriff Ross indicated that Campbell and Dugdale should try to agree the balance of costs between themselves – but striking an accord may prove difficult. Dugdale might be expected to push for a full recovery of her lawyers’ costs.

The general principle is that expenses follow success. Sheriff Ross held that Dugdale had a valid defence to the action for defamation. Applying the courts’ ordinary approach, this puts Campbell on the hook not only for his own bills, but Kezia Dugdale’s too. But as we saw in the 2015 election petition taken against Alistair Carmichael, it isn’t always so simple.

In upholding Carmichael’s election, the court held that “we had no concerns about the credibility and reliability of the witnesses, with one exception”. The solitary shoogly nail? The LibDem MP for Orkney and Shetland, speaking in his own defence in court. For Carmichael, expenses didn’t follow success. He kept his Westminster seat, but Lady Paton and Lord Matthews left Carmichael to settle his own legal bill.

Reading the runes in Sheriff Ross’s judgment, it isn’t obvious where his inclinations will tend. In contrast with Carmichael’s case, here the judge accepted “both Mr Campbell and Ms Dugdale were presenting their respective positions in a principled and honest manner,” accepting “all of the witnesses were credible and reliable”. When it comes to who bears the final – potentially ruinous – expense of this divided case, time will tell.