AS many are tales of murder and ­retribution, they might be seen as grim and depressing affairs.

However, Scottish readers have a distinct love affair with the crime novel. New figures show the genre is the most popular choice for people borrowing books from their local library.

The top 20 most read books from libraries all belong to the crime or thriller genre, and the list features Scottish writers Ian Rankin and Stuart MacBride in 5th and 7th position respectively.

Lee Child, creator of the Jack Reacher novels, holds the number one position, with his book The Affair, the 16th novel featuring the character, being the most borrowed book in Scotland in 2012/13.

Three titles by James Patterson also feature in the Scottish top 10 and the US thriller writer was the most borrowed author in libraries across the UK as a whole for the seventh year running.

Dom Hastings, the manager of Scotland's annual international crime writing festival, Bloody Scotland, said crime fiction remains popular because it does not only hold a mirror to society but provides a mental challenge for readers.

He said: "It is a very accessible genre, but also one that can reflect society and do that in a very short period of time. It can catch the moment.

"Not all crime writing provides satisfactory conclusions either, although they can do that, but the plots often provide a mental challenge and that can be attractive for readers."

Jim Parker, the head of PLR, said: "It is difficult to say why Scotland loves thrillers and crime, but it is a very marked preference and I can say there has never been such regional variation across the UK. I guess Scotland just has an appetite for hard-hitting fiction, and it is a very strong trend.

"It has been trending that way for a few years but every book in the top 20 in Scotland is a crime or thriller novel."

The UK-wide data, released annually by the Public Lending Right (PLR) office, features two top ten appearances by literary novels, including Hilary Mantel's 2012 Man Booker winner Bring Up the Bodies at eight and The Casual Vacancy by JK Rowling, her first novel intended for adults, at 10 in the UK list.

Fifteen books by US thriller writer Patterson appear in the UK's Top 100.

The erotic bestseller Fifty Shades of Grey by EL James is at number three in the UK top 10 most borrowed titles list. However, The Affair by Lee Child is also number one in the UK list.

While crime and thrillers were most popular in Scotland, Fifty Shades of Grey was the most borrowed book in both Essex and Suffolk. Borrowers in London preferred Diary of a Wimpy Kid, while those in Yorkshire had Bring up the Bodies by Hilary Mantel as their most popular.

PLR is funded by the Department for Culture, Media and Sport (DCMS) through the British Library. This year PLR is distributing £6.1 million to 22,372 authors at a rate of 6.2p per loan.

Since it started in 1979, PLR has distributed over £144m to authors. Authors are eligible for payment if their PLR earnings reach a minimum of £1 with a maximum payment threshold of £6600.

The new figures also show there has been a jump in the number of erotic fiction titles taken out from UK public libraries.

Destined to Feel by Indigo Bloome was the most popular title in the erotic fiction category during 2012/13, borrowed nearly 11,700 times from UK libraries. Mr Parker added: "It has been a growing trend for some time."

In total, 23.9 million books were loaned from public libraries in Scotland from 2011 to 2012, compared to 25 million in 2010-11 and 25.7 million in 2009-10.