Not that long ago, a thread on a mystery discussion group caught my attention. It had to do with historicals, and whether or not it was appropriate for a real-life person from the past who had no criminal record to be put into print as a murderer. With very few exceptions, most of the correspondents insisted that this should never be done, that it would be tantamount to a post-mortem smearing of the person's reputation. The majority opinion also held that such a course would make a story unbelievable, and that it would be not only immoral, but bad art as well.
I think a writer's primary obligation, one that overrules all others, is to be true to the story. In writing an historical, I do all I can to present known facts accurately - otherwise, yes, my readers will be distracted, and unable to remain in my fictional world. But I'd have no problem with a story which features a well-known historical figure as a murderer, so long as the motive for the murder is accounted for, and fits comfortably into the history.
Fictional people, no less than inhabitants of the real world, are never one-dimensional, and we all have at least a couple of pretty unsavory characters who sit on the boards of directors in our heads, and determine our thoughts and actions. Suppose that as a young boy, Gandhi witnessed a horrific attack by a British officer on someone he dearly loved. Not only that, the attacker contrived to get off scot-free. Then, when Gandhi reached his mid-teens, he was suddenly and unexpectedly presented with an opportunity to murder the attacker, and without even thinking about it, he did just that. Then, afterward, perhaps over years, as he considered the situation, he came to the realization that his act of revenge had done no one any good, that he'd lessened himself in his own eyes, and that an uncompromising pacifism is the only proper human course to take.
Or, how about an alternate-universe story? Suppose Gandhi's boyhood broodings, followed by his murderous response to the British officer set him on a course of violent opposition to the British occupation of his country? How might the world be different now?
To make it clear to readers what was real in my stories and what was made up, I write afterwords to my historicals. Still, I don't think any fiction writer can smear the reputation of an historical figure. In fact, I suspect that most of the subjects so portrayed might even be entertained by the idea of taking to the stage for a few hours to play murderer.