The writer behind the Games of Thrones phenomenon has admitted obsessed fans sometimes guess correctly where his famously bloody plotlines may go next.

At a packed appearance at the Edinburgh International Book Festival, the American author of the saga A Song of Fire and Ice, who is working on two more novels in the series and is publishing a guide to his world of Westeros, said it occasionally felt like fevered fans had read his mind.

George RR Martin, 65, who has been called the American Tolkien and whose work is the basis of the hugely successful Game of Thrones TV series, said he does not change plots if fans guess correctly in order to confound them.

He also outlined how much Scotland and Scottish history inspired his books.

Martin began the session by explaining how a visit to Hadrian's Wall had inspired him to create the epic ice wall in his books.

He joked: "If Scotland does secede it should built a gigantic wall of ice. It would be a great tourist attraction, as well as keeping the English out."

Of the many fan theories on the internet about his stories, he said: "I hate predictable fiction, I want to surprise and delight my readers and take the story in directions they didn't see coming.

"But I can't change the plans and that is one of the reasons why I used to read these fan [internet] boards back in the 1990s, the early ones, and then I stopped.There was this issue that so many readers were reading the books with so much attention and throwing up so many theories - and some of the theories were amusing but very creative - but some of them were right.

"The readers, at least one or two, had correctly put together the clues that I planted … so what do I do then? Do I change it?

"I wrestled with it, but I think changing it would have been a disaster. The clues were there."

He said he does not now follow the many fan websites discussing his novels and characters. "But it pleases me no end that people are discussing the characters as if they were real," he said. "It's a sign that I have created real characters and not just blank pieces of cardboard."

Martin said several women from Scottish history inspired characters in the saga. "I enjoyed Xena the Warrior Princess a lot but I did not think it was an accurate portrayal of what a women warrior was or would be like, and I sort of created Brienne of Tarth as an answer to that.

"I was inspired by people like Eleanor of Aquitaine and not so much Joan of Arc, but the queens of Scottish history, from Lady Macbeth on down - strong women who didn't put on chain-mail bikinis to go forth into battle, but exercised immense powers by other ways."

Martin has another appearance at the book festival today at 3pm.