Having started my novelist's life as something of a librariaphobe, I am now one of the British Library's most enthusiastic converts. It works for me: its climate control, padded desks, wide chairs and, most importantly, its conveyor belt of books that rarely falters.

In fact my criticisms are restricted to the catering. Not just of the food, but those echoing, scrabbling, ill-lit corridors that pass as adequate places in which to sit and digest. And there's a space problem. At peak times, the hunt for somewhere to rest a plate becomes particularly frenetic. The only remedy is the very unBritish one of sharing with a stranger.

Which is how I found myself the other day, having coffee with a man I didn't know. It had been a slow day and my mounting stack of reservations felt increasingly unappealing. Looking for serious diversion, I asked my table companion his life history.

I had lucked out. His was a fascinating story, particularly his career trajectory: he was a former elite civil engineer who had become a successful actor. The caffeine was thick in both of us by the time he'd told me how he'd made the leap from one such seemingly diverse career to the other.

Then he returned the compliment by asking me what I was doing in the library. Looking for an idea for my next novel, I told him; without much success - or so it felt that day. He asked how I was going about the search. I muttered something about Armenian genocides, flu pandemics and Suez crises. It sounded even odder than it had felt in the reading room. Not, however, to my companion. He nodded, and then, in an apparent non sequitur, told me that the reason he had been able to make the transition from engineer to actor was because he had understood that, no matter what the discipline, the creative process is similar. Part is knowledge and experience, he said, part hard work. But the final and most important part is to allow your subconscious free rein. Which means that you, he concluded, are going about the search for an idea exactly the right way: the only thing you're doing wrong is that you don't trust that it will work.

Sweet words from a stranger. After he left I continued to sit, thinking about what he'd said.

"Where do your ideas come from?" That's the question that always dogs me when I give talks. Since I am a writer to whom ideas come hard, I can only answer it in hindsight. Take my last, I say: Ice Road. A novel set in the Leningrad of the 1930s, it was born out of my admiration for the film director Sergio Leone.

I'd always loved Leone's spaghetti westerns, but those opening frames of Once Upon a Time in the West, with its hard men, their fawn dusters and the machine soundtrack, made me a lifelong Leone fan. When I was writing my novel Red Dust, set in a desert town, I kept in mind Leone's structure of a seeker-after-justice riding into town. And then, searching out an idea for the book to follow, I heard that, before his sudden death, Leone had been planning to set his next film inside the Leningrad siege.

Leningrad's heroic defiance of the German encirclement had always fascinated me. This, along with the Leone connection, was enough to send me to the library. I became fascinated, not only by the city's war-time years, but by the period leading up to the siege; by the way ordinary people survive tyranny. I read and read, giving myself permission to follow instinct. Which is how, having taken that all-important decision to set my novel-to-be entirely within the city perimeters, I ended up following an intriguing footnote into the Arctic - many hundreds of miles from Leningrad. Conscious planning sounded out a warning note, but instinct and, I guess, my subconscious told me to persist, a decision I was never to regret. And so finally, out of an age-old admiration for a dead film director, I had found the book that would keep me occupied for the next few years.

So where do ideas come from? Beats me. But if you happen to catch me in the library corridor, chatting with a stranger, don't for a moment assume I'm not working. I'm actually doing the hardest work I know: keeping myself open for the onset of the right idea.