Scotland's position as pole star in the literary crime firmament was confirmed this year in several remarkable ways.

The week before Christmas, Ian Rankin's eighteenth Rebus novel, Standing In Another Man's Grave, narrowly pipped JK Rowling's A Casual Vacancy to the number one British Christmas bestseller position for hardback fiction, selling around 22,000 copies since last month.

Had Rowling whipped up another 55 sales, she would have overtaken him and won the crown. But regardless, that two Scottish-based novelists were neck-and-neck for star position shows how far above the rest of their British peers our crime writers have risen.

In what was an exceptionally rich year for Scottish skulduggery, Rowling's entry to its ranks was unexpected and no doubt, for some, unwelcome. Much was said about her debut adult novel, not all complimentary, but Rankin and his publisher were aware that whatever the reception, she would offer stiff competition, not least in the column inches she was given.

Probably wisely, Standing In Another Man's Grave was held back until November to avoid the tsunami of publicity for Rowling. But added to clever timing, Rankin's sterling credentials as a Presbyterian workaholic helped secure him first place. He has been so assiduously touring with the book he's at serious risk of repetitive strain injury after signing so many copies.

Crime and an appetite for hard work typify Scotland's literary scene, where writers might think they were in the book world's equivalent of a salt mine, given how little respite they get from publishers and readers between works.

While there has been some excellent prose in 2012 from the likes of James Kelman, Janice Galloway, Rodge Glass and Jackie Kay, and good poetry from Kathleen Jamie, Stewart Conn and William Letford, by far the most prominent and successful writers have been those in crime. What is becoming increasingly evident, too, is the variety of stamping grounds among writers in this category. It's as if the nation's novelists are keen to fill in the criminal map and give a voice to the dark side of every home city and town, and far beyond too.

So among many more the year included the second in Peter May's trilogy set in Lewis, the third outing for Russel D McLean's Dundee-based detective J McNee, and a new foray for Shirley Mackay's sleuth Hew Cullen, sent on another chase in 16th-century Fife.

Louise Welsh's thriller The Girl On The Stairs was set in Berlin. In Dark Summer In Bordeaux, Allan Massie's melancholy Superintendent Lannes found himself in ever deeper waters in the wartime town as he and its nervous citizens face encroaching Nazi control. Reprising murky 1950s Glasgow, Craig Russell's detective Lennox was back at work in Dead Men And Broken Hearts. Denise Mina continued her Glasgow-based series with detective Alex Morrow in Gods And Beasts, and fellow portrayer of Glasgow Alex Gray published the ninth of her series featuring DCI Lorimer, A Pound Of Flesh. Doug Johnstone froze the blood with his amoral chiller Hit And Run; Stuart MacBryde, Val McDermid and Gillian Galbraith turned the stomachs of the squeamish; and the likes of Philip Kerr and Andrew Nicoll, with If You're Reading This I'm Already Dead, used unsolved mysteries as the hook, with varying degrees of irony.

Whether something in the Scottish psyche makes crime the first haven for the fictional imagination, or whether the global hunger for the genre is the trigger, nobody can dispute that few countries have a greater predilection for writing and reading this sinister material.

It's fitting, then, that our fascination with crime found a tangible home in September's inaugural Bloody Scotland festival in Stirling. The first festival in Scotland devoted to international crime fiction, but with a strong home flavour, was a great idea and one wonders why nobody thought of it before.

One of the most interesting decisions, to republish William McIlvanney's novels, starting next spring with Laidlaw, was announced by Canongate. His fiction cannot be pigeon-holed, but he is widely credited for igniting the present bonfire of depravities with this dourly charismatic detective and his superb portrayal of the world he works in.

Christopher Brookmyre is one of many who acknowledge their debt: "It's doubtful I would be a crime writer," he writes, "without the influence of McIlvanney's Laidlaw. Here was a literary novelist turning his hand to the urban, contemporary crime novel and proving that the form could tackle big moral concerns."

McIlvanney set the bar high, but each year, and never more than in 2012, Scotland's writers rise with growing vigour to the challenge.