WRITING, as the late, great Cliff Hanley remarked, is better than working.

What other job can you justify with the excuse that while you may not look as if you're doing anything productive you are actually engaged in "research"?

Often when I am in research mode I find my footsteps lead me in the direction of a library. For as J Alfred Prufrock measured out his life in coffee spoons mine has been in thrall to libraries.

My first library was our local one where the custodian was a middle-aged woman who used to inspect our hands for dirt with forensic severity. Books to her were objects of reverence, ideally to be kept in a glass case. You despoiled them at your peril.

Other landmark libraries include the one in south London where immigrants from the Caribbean congregated to study and flirt and dry their sodden socks on radiators. It was there I first found Dylan Thomas and Lawrence Durrell and countless other authors to whom I remain nostalgically faithful.

A few years later I worked as a librarian in the centre of Edinburgh. Every day brought fresh gusts of readers, as they were then known, some of whom gave the impression that there had been an amnesty in the asylum. In an attempt to preserve my own sanity I'd disappear into the stacks on the pretext of "stock control" and read whatever took my fancy.

For me, who had grown up in a house with very few books, the library was a place of sanctuary and infinite possibility, on whose shelves lay numberless passports to lands real and imaginary. Libraries were so self-evidently good things it seemed unthinkable that anyone could possibly denigrate them or deny people access to them. They were to the mind what the National Health Service was to the body.

Of late, however, assaults on the well-being of the public library have been frequent and vicious. Always an easy target in times of financial constraint, libraries have watched in dismay as professional librarians have been made redundant, branches have closed or had their hours curtailed, and book budgets have been slashed.

The effects of all of this are not easy to measure. But what those, including Julia Donaldson, the Glasgow-based Children's Laureate and author of The Gruffalo, who have been campaigning against such cuts are clear about, is that it's the less affluent who suffer from them the most.

Yesterday the campaign held a rally in London and made plain its anger to MPs. Among those participating was John Bird, founder of The Big Issue, who recalled that he'd wanted to join his local library when he was six but his father wouldn't let him because he'd borrowed a book decades earlier which he hadn't returned. Mr Bird finally learned to read and write in a young offenders' institution where he was fed books from the prison library by one of the warders. The first book he read was The Scarlet Pimpernel.

Where libraries are concerned, such stories are legion. My own favourite concerns Jimmy Reid, that most eloquent and erudite of contrarians, who was asked by Jonathan Miller, the polymath, which university he'd attended. "Govan Public Library," replied Mr Reid.

Even in the age of the internet, when fatuous commentators talk glibly and ignorantly about the death of the book, the idea that a library, like an operating theatre, is free at the point of entry still seems valid. Certainly there is no dearth of clients in those that I visit, even if they are only there to surf and survey the talent.

If you doubt it, may I recommend a trip to the Mitchell in Glasgow, which is certainly Europe's biggest public library and quite probably its greatest. Currently, it is host to the Aye Write! book festival, of which The Herald is sponsor, which somehow manages to be both popular and intellectually entertaining.

Last weekend there were queues for debates on independence and the future of the media. Richard Holloway, formerly Bishop of Edinburgh, made doubt seem as appealing as sin and Janice Galloway talked about needing nerve to write about herself. There was more, much more. It felt like a library in which the books have come alive.