When Scottish crime writer Ian Rankin first conceived of his new novel, Standing in Another Man's Grave, he didn't intend it to be an Inspector Rebus book.
"It was a book about a parent looking for a child who'd gone missing a decade ago," says Rankin who "retired" Rebus, arguably the world's most curmudgeonly detective, in 2007, to a public outcry that hasn't been rivalled since that other legendary Edinburgh crime writer, Sir Arthur Conan Doyle, killed off Sherlock Holmes in 1893.
"I didn't stop writing about Rebus because I had nothing new to say about him," says Rankin, who with worldwide sales in excess of 17 million for his Rebus books alone, is not just the UK's top-selling crime writer but one of its highest-earning novelists. "I wasn't bored with the character; it was just that real life meant that he would retire."
Nor was he bored with writing. During Rebus' "retirement" Rankin penned a stand-alone novel about an Edinburgh art heist, Doors Open, which went on to outsell his Rebus books. It has now been made into a TV film starring Stephen Fry.
He also created a new crime series featuring an altogether different kind of Edinburgh detective, Malcolm Fox, who works for The Complaints, the police internal affairs division. "He's less cynical, he works well as part of a team, he's not a natural anarchist in the way Rebus is, so that allows me to show Edinburgh in a slightly different way."
Intriguingly, Rebus and Fox not so much meet as collide in Standing in Another Man's Grave, Rankin's 18th Rebus novel and his 32nd book to date. Fox views Rebus as a kind of dinosaur who has no place in a modern police force and is just waiting for him to slip up.
The notion of Rebus' return presented itself to Rankin while pondering the actions of the parent of the missing child.
"I realised that they would contact the police who would then contact the cold case unit, and I knew that was what Rebus was doing. At the same time, I also discovered from a cop that they'd changed the retirement age, and Rebus could apply to come back in, so he'd be vetted by Complaints and that would bring Malcolm Fox into the picture. So it all just kind of clicked.
"But the real challenge was to show Malcolm in a less flattering light but still leave open the possibility that I can write future books about him."
Standing in Another Man's Grave, it has to be said, goes down as smoothly as a dram of the fine single malt so favoured by its sharp-humoured, hard-drinking protagonist. Taking its title from a song by Rankin's friend, Scottish singer/songwriter Jackie Leven, who died in 2011, the novel takes Rebus far from his beloved Oxford bar in Edinburgh - now a tourist attraction on the back of the books - up north to Inverness and the Black Isle.
"It was fun to take him out of his comfort zone," says Rankin, "further away from a pub than he's ever been in his life.
"But there's a subtext in this book, which is, where is Scotland going as we head towards the vote in 2014 for independence? What kind of country is this? So Rebus is exploring this country, trying to make sense of it, trying to find out if it's a unified culture, or if it's just the coming together of disparate people."
For Rankin, who has been using Rebus as a vehicle for taking Scotland's pulse ever since the cantankerous detective strolled unbidden on to his pages in Knots and Crosses in 1987, "every book is a another little piece of this jigsaw of modern Scotland".
"And if the series does come to a conclusion, that maybe will present a picture of the way Scotland was at the end of the 20th and the beginning of the 21st centuries."
Twenty-five years later, he is still at a loss to fully understand Rebus' global appeal but acknowledges his fictional creation as a potent and enduring entity in the public imagination. "He just seems very real to people and I think they are often disappointed when they walk into the Oxford bar and he's not here and they have to deal with me instead.
"I'm not Rebus. There's a little bit of me in him but I'm not as complex, I'm not as damaged. But what Rebus does in the books is try to piece together a story, a pattern that will explain the world to his satisfaction. And that's basically what I'm doing - creating a story to explain the world."
'But there's a subtext . . . which is, where is Scotland going as we head toward the vote in 2014 for independence?'