I REMEMBER attending an SNP conference a few years ago and having an interesting experience with Ineos. The petrochemical giant had caused a bit of a stooshie that year, 2015, by booking a stall at the event when the issue of fracking was such a hot debate.

As luck would have it, my organisation had a stall almost right next to it. It was fascinating to spend a couple of days observing the Ineos charm offensive. It was going to great lengths to woo supporters of the Government over to the pro-fracking cause.

I was targeted by the charm offensive, too. As the editor of an online news site that had covered much of the debate from a campaigning perspective – and campaigners were generally opposed to it – Ineos didn’t consider our approach all that helpful. The Ineos folks greeted my reporters and me like old friends, even though we’d never met, and it was hard to walk past any of them without being drawn into yet another encounter.

The presence of Ineos at the conference was just the latest in a wider information war over fracking. The practice is controversial because of fears that it damages the environment and causes pollution which is dangerous to health. It has even been linked to earthquakes and tremors.

Big businesses, like Jim Ratcliffe’s Ineos, stand to make a tidy profit from it, however, and companies involved in the energy sectors tend to have a large wallet when it comes to lobbying for favourable outcomes in politics and public opinion.

Indeed, Ineos was even willing to hit local town halls in efforts to win over communities. Months before that SNP conference, a company spokesman promised to drink “a lot of tea in a lot of village halls” as Ineos kicked off an “information programme” in towns such as Alloa, Falkirk, Bishopbriggs and Cumbernauld.

The drive was part of an effort to reverse the direction of travel; the Scottish Government had already imposed a moratorium on fracking by then, and there was a sense that the SNP might move to a full ban.

There was much support for this stance within the party membership – much of which was newly signed up following the post-independence referendum surge. Many of the newbies had come straight from referendum campaigning and radical dreams; saying no to fracking meant standing up to big corporate business for the sake of the people on the ground, and there’s no doubt it was a popular position.

It wasn’t a universal view, however, on the pro-independence side. Voices such as Jim Sillars, former SNP deputy leader, urged the Scottish Government to think again about its position. Some argued that it was naive and counterproductive to cut off a potential revenue stream that could kick-start the economy in an independent Scotland.

But the matter was finally settled last year, when the Scottish Government announced that fracking would be banned completely. Scottish Energy Minister Paul Wheelhouse warned the practice would cause “long-lasting negative impacts on communities”, and campaigners applauded the Government for its decision.

But Ineos wasn’t so pleased, and the gloves started coming off. Gone were the charm offensives, replaced instead by court papers. The corporate giant wanted a judicial review of the Government’s decision, believing it to be illegal.

And so it began trudging through the courts, until yesterday, when finally Scotland was delivered the most unexpected of verdicts.

Judge Lord Pentland threw out the legal challenge from Ineos (hooray for the people!) because, it turned out – by admission of the Government itself – Scotland actually hasn't banned fracking (hoora … what?).

It was like the Scottish Government had pulled a massive prank on Ineos.

It turned out that fracking is “effectively” banned, and that one word is the difference between winning or losing a court case.

It’s about process. The route taken by the Scottish Government to prevent fracking – by way of using planning laws until firmer policy is nailed down – means that it won’t happen in Scotland, but it also means Ineos can’t beat the decision in court. At least, not on this occasion.

Critics of the Government had earlier accused it of stopping short of a real ban, of misleading the public, because of its approach. However, had it taken a different route to implement a ban, it may well have lost in court yesterday.

As discomforting as it was in a world of fake news to see the Government’s legal representative in court claim that there is no ban on fracking when the Government was simultaneously claiming in public that there is, perhaps there may have been method behind that madness.

However, using the planning laws to prevent fracking is only as good as the Government that’s overseeing it. A change of administration at Holyrood could overturn the policy relatively quickly, and from party conferences to tea parties and court rooms, Ineos won’t give up easily. Watch this space for the next plot twist.