Judge Martin McKenna ruled that, as the closures would hurt disadvantaged groups such as the elderly and the disabled, which is contrary to the conditions laid down in equalities legislation, the councils would just have to scrap their plans and think again. And he also made it crystal clear – as he quashed the closure decisions and told the councils to pay campaigners' legal costs – that he was sending a message to other local authorities intent on restructuring their library services.

The councils had claimed "hyperbole, exaggeration and hysteria" on the part of the campaigners. But Judge McKenna, reflecting on how the case had been conducted, described the campaigners' approach as "perfectly reasonable" and "proportionate" even in the areas where their legal claim had not been successful.

Daniel Carey of Public Interest Lawyers, who acted for the campaigners, welcomed it as a "vindication for library campaigners in Somerset and Gloucestershire and nationally, and for the rule of law". (Meanwhile, rather puzzlingly, leader of Gloucestershire council Mark Hawthorne told Channel 4 News that the case had been lost on "a very small technical point" – a direct contradiction of the judge's own remarks just beforehand, in which he called the breach of equality duties involved "substantive, not merely a technical or procedural defect".)

To call this a turning point in the lengthy battle for the public library service would be premature. Somerset and Gloucestershire councils will return with new proposals – and James Goudie QC, who acted for the councils at the judicial review, suggested that financial pressures being what they were, the next round of plans on offer could be even more "draconian" than the ones that the court had rejected.

Councils are desperate to save money on libraries, and are increasingly looking to volunteer-run ventures as a way to do it. Some communities feel coerced into accepting such plans, despite widespread fears that they are simply unsustainable in the long term. Meanwhile the government ministers with the responsibility to check that the service is being properly looked after – culture secretary Jeremy Hunt and culture minister Ed Vaizey – have become notorious for their unwillingness to become involved.

But a clear line has now been drawn on equalities law, and up and down the country, local authorities will now be closeted in urgent meetings with their legal advisers to review their library plans.

Somerset and Gloucestershire campaigners should rightly celebrate, and be celebrated. It is a real achievement, despite all the barriers in their way – including the raising of over £20,000 towards legal costs – to have stopped local closures in their tracks.