Does historical fiction have a duty to be factually accurate? It's a question I've found myself discussing a lot lately, most recently on BBC Radio 4's Today programme with Sarah Churchwell, who claimed that some historical novelists use "poetic licence" as an excuse for sloppy or minimal research. I had a conversation on the same theme the week before at the Independent Bath Literature festival with fellow novelist Sarah Dunant, who argued forcefully that authors have a responsibility to not present readers with deliberately false information about a historical character or period, and to make clear how much they have invented.

It's certainly true that historical fiction is enjoying a boom at the moment, from heavyweight prizewinners such as Hilary Mantel and Andrew Miller to more populist series from authors including Philippa Gregory, or historical crime by the likes of CJ Sansom, Jed Rubenfeld or my own alter ego, SJ Parris. It's also the case that for many readers, a historical novel might be their point of entry or perhaps their only real window into a particular period. Shouldn't authors therefore take care not to spread an "incorrect" version of what actually happened?

Well, no, in my view, although I do agree with Churchwell on the paramount importance of meticulous research. But novelists are not history teachers. It's not our job to educate people, and if we start using words like "duty" and "responsibility" about historical fiction – or any fiction – we're in danger of leaching all the vigour out of it with a sense of worthiness. A novelist has no real duty to anything except the story he or she is creating, the characters who inhabit it and whatever view of the world he or she is offering with the novel's ending. But if you are going to play fast and loose with historical fact for the sake of a good story, you'd better have done your research thoroughly if you want readers to take you seriously; only then will you have the authority to depart from those facts.

I have no problem with the idea of an author reinventing Abraham Lincoln as a vampire hunter, for example, as long as the fantasy is grounded in a knowledge of his biography and the book is well-written. At least it's obvious to readers that it's made up. Far more irritating to me are films such as Becoming Jane, which seemed so taken with the idea of turning Jane Austen into one of her own romantic heroines that it brushed aside even the most basic understanding of Austen's life and circumstances.

I've had a reader take me to task – rightly – over an incorrect detail of clothing worn by the hero of my books, the 16th-century Italian philosopher Giordano Bruno, even while they seemed quite happy to accept the much more flagrant invention of turning him into a spy who solves murders. Among my favourite novels as a teenager were Peter Ackroyd's The House of Doctor Dee and Hawksmoor, historical novels that shade into magic and fantasy, but do so from a solid foundation of knowledge of the period. I may not have learned "accurate" history from those books, but I acquired a love for the atmosphere of the past through the imagination of a great storyteller.

"Histori

Inspiration … Peter Ackroyd's novels shade into magic and fantasy, from a solid historical foundation. Photograph: Murdo Macleod for the Guardian

cal fact" is an ambiguous term. We can point to certain events taking place on certain dates – though the further back you go, the more even the dates are open to doubt – but we often don't know what was said off the record, or how the principal players behaved when the chroniclers looked away. These undocumented areas often provide the most private, human moments, away from the public stage, and the blank spaces they leave are irresistible to a novelist. Even "straight" biographers and historians are not above a bit of imaginative colouring-in if it brings the story to life.

The growing popularity of narrative non-fiction, together with the penchant for dramatising key scenes in TV history documentaries, are a further reminder that stories and characters engage our imaginations beyond dates, treaties and troop movements – though in the best history and biography, you'd hope to find both.

The words "based on" and "author's note" are essential to the historical novelist's toolkit. By making clear that you're writing fiction, you claim the freedom to speculate, to stray beyond what is known, and so breathe new life into long-dead characters. Any attempt to recreate the past requires a leap of imagination. If a bit of poetic licence in historical fiction helps to keep people's interest in the past alive, so much the better.

• Treachery by SJ Parris is published by HarperCollins