Image caption Trainspotting gained more than 800 of the 8,800 votes cast

Irvine Welsh's debut novel Trainspotting has been named as Scotland's favourite book of the past 50 years.

The cult story of drug addiction in Leith topped a poll for Book Week Scotland with one in 10 votes.

Welsh said he was flattered that the book, which celebrates its 20th anniversary this year, had even made it onto the list.

Lanark by Alasdair Gray was second, with Ian Rankin's Black and Blue third.

Responding to the poll, Welsh said: "I don't know if Trainspotting is the best Scottish book - I'm far from convinced it's my own best book.

"But I'm obviously flattered just to be on that list of great novels with those amazing writers, especially when I consider some of the brilliant books and my personal favourites that never made it onto this list."

Gray said he was "delighted and astonished" that his first novel, Lanark, had been judged more popular than a book by Rankin.

Black and Blue was Rankin's eighth Inspector Rebus tale.

The crime writer said it was an honour to be included in the top 10 with a book he regards "with great fondness".

He added: "I'm sure the results will be pored over and discussed, but what really matters is that books are still read with a passion. I feel sure this will be the case in another 50 years' time."

The 10 favourite Scottish novels of the last 50 years 1. Trainspotting by Irvine Welsh (833 votes) 2. Lanark by Alasdair Gray (750) 3. Black and Blue by Ian Rankin (591) 4. The Bridge by Iain Banks (496) 5. One Fine Day in the Middle of the Night by Christopher Brookmyre (416) 6. Excession by Iain M Banks (330) 7. Morvern Callar by Alan Warner (296) 8. 44 Scotland Street by Alexander McCall Smith (282) 9. The Trick is to Keep Breathing by Janice Galloway (271) 10. Docherty by William McIlvanney (269)

Two novels by Iain Banks, who died from cancer earlier this year at the age of 59, were included in the poll: The Bridge and Excession, the latter written under his science fiction name Iain M Banks.

Banks' widow Adele Hartley, whom he married shortly after announcing his terminal illness, said: "Iain was always a huge fan of his fans and I think he'd have been very flattered by their support and delighted to be in such fine company."

Book lovers from as far afield as the US, Ethiopia, Iceland and South Korea got involved in the poll, held to coincide with Scotland's week-long celebration of reading.

More than 8,800 people cast a vote for one of a shortlist of 50 titles compiled by author and literary critic Stuart Kelly and Scottish Book Trust staff.

Mr Kelly said: "Crime, comedy, science fiction, the avant-garde - the public vote has reinforced the diversity of contemporary Scottish writing."

Female authors

But he noted a shortage of female authors, with Janice Galloway the only woman writer to make the list at number nine.

"My sole regret is that we have only one woman on the list - that said, The Trick is to Keep Breathing is indubitably a contemporary classic," he said.

Marc Lambert, chief executive of Scottish Book Trust, said: "This is a fascinating list combining traditional classics with modern greats, with every book an absolute gem.

"Aside from acting as a barometer of Scottish reading tastes, the list has amply fulfilled its purpose of generating an exciting debate and discussion around great Scottish novels.

"Trainspotting is undoubtedly deserving of the top spot. It remains a brilliant read and its publication was a key cultural moment in the history of the Scottish novel."