The police tape wrapped around the billboards in Lothian Road and Grindlay Street beside the Royal Lyceum Theatre, Edinburgh, suggest a serious incident is under investigation.

In fact, as the posters make clear, it has yet to happen. Dark Road, the first stage play by Ian Rankin, the crime novelist and creator of Inspector Rebus, is still in rehearsal and actress Maureen Beattie is squaring up to her nemesis.

Beattie plays a top Edinburgh cop who was instrumental in the conviction of an alleged serial killer 25 years ago. Now, on the verge of retiring, she must face up to the doubts that have been lurking at the back of her mind for a quarter of a century. She must also face up to the man whose life she effectively took away.

This is typically gritty stuff from Rankin, who has co-written the play with Lyceum artistic director Mark Thomson, who also directs the co-production with the Wales Millennium Centre in Cardiff.

On a rare day off in the capital between book tours in South Africa and France, Rankin reflects on the experience in a coffee shop, where the music being played through the speakers is, somewhat appropriately, The Police. Pop trivia expert Rankin takes his cue from Walking On The Moon.

"Wasn't it originally called Walking Round The Room or something?" he ponders about a song originally written by Sting in a hotel room while drunk. Given that Rankin has just been marvelling at what is and is not physically possible on stage compared to the page, this observation is fitting.

"There are tape recordings," Rankin says. "There are projections, there are bits where people appear in a room but are part of a dream sequence. It's quite awkward to get your head round. If I had known how hard all that stuff was … it looks easy when you write it down. Just getting someone in and out of a room, stuff I had never thought about.

"You think, 'Okay, people are on the stage, and the next scene you need the same people, how are they supposed to change?' Luckily, I'm working with a director who will tell me, 'No, Ian, you can't physically do that on a stage,' so you need to find a way to do it."

As a regular at Lyceum shows, Rankin came into contact with Thomson some years ago, and first talked about trying to put Inspector Rebus on stage. While the logistics of putting some 30 to 40 characters that grace a Rebus novel on stage proved prohibitive, it nevertheless inspired an even more interesting idea.

"Mark said, 'How come you see so many cops on screen, but we never really see contemporary police drama on the stage? You've got your classic Agatha Christies, and plays that verge towards the supernatural, like The Woman In Black, but cops? Maybe it can't be done.'"

Rankin came up with some storylines, and eventually found one that appealed to Thomson and himself. The author came up with the characters and twists, story-boarded it, then handed it over to Thomson, who structured it before the pair went through it again, being careful not to cut too many corners in terms of police procedures. Then something happened that changed everything.

"They changed the entire structure of the police in Scotland," Rankin says of the recent amalgamation of all regional police forces into one body now known as Police Scotland. "The main character in the play was originally the first female chief constable in Scotland. Now there is only one chief constable in the whole of Scotland, and it can't be her. She can't be at the very top. So now she is superintendent.

" For my latest book, which comes out in November, I thought about restructuring it after the police restructuring happened on April 1, but I decided to set it in March to get past all that. We could have done that with this, but Mark wanted it to be as contemporary as possible."

The story of Dark Road was inspired by a real case in which a killer not only confessed to the crime under investigation, but led the investigating officer to a second body. As the officer had not gone back to the station and questioned the suspect, however, rules were considered to have been broken, and the officer was disciplined.

"It was not like he was beating up a suspect or anything," Rankin points out, "but because he had not followed every letter of the law, it went against him, even though the second victim's family think he did the right thing, because it brought them some kind of closure. So there is this notion that procedure can have a big effect on something, and that something that wasn't done properly 25 years ago can come back and haunt you."

Rankin describes Dark Road as "a psycho-drama, a whodunnit with a twist, but Mark and I also want it to be a crowd-pleaser, and something that is going to get people away from their tellies. It is a steep learning curve for me, because it is a different way of telling a story.

"Essentially, novelists are quite lazy, because they let the reader do all the work for them, but working with actors, even on the first day they were asking questions about why their character was doing something in a way a reader would never be able to ask.

"Speaking as someone who has gone to the theatre throughout his life, I am very naïve. Seeing how everything works behind the scenes, it has given me a whole new respect for what actors do."

With this in mind, will Rankin be pursuing drama further?

"We'll see," he says, "but I won't make it as complicated next time."

Dark Road, at the Royal Lyceum, Edinburgh, from tomorrow until October 19.

l www.lyceum.org.uk