It is my belief that writers should write what they want, how they want.
There is a misconception prevailing in some circles that, for example, a writer who writes a racist character must be racist themselves. They twist our works into manifestations of subconscious bias. And I find this ludicrous coming from a background of literary criticism.
Firstly, they fail to realise that writing is by and far a left-wing profession. I have yet to meet a writer who is openly on the right. The left wing almost always depicts the racists, the sexists, the homophobes, the general bigots, as the bad guys. That’s most likely what they’re doing here.
Secondly, to suggest that a writer is bigoted for writing a bigoted character is a baseless attack on their integrity intended to pigeonhole them into writing “acceptable” characters. Let’s say a protagonist is a reformed racist skinhead who spent twenty years in jail for murdering a black man. The character struggles with his new life and trying to expunge racist thoughts from his head. This is a fantastic, gritty, realistic character but they’d still think that the author is racist for writing about his battle. The very best characters have layers of good upon bad upon good upon bad, skeletons either in or out of the closet. If these people had their way, we’d only be writing characters who wouldn’t seem out of place in a 14 year old’s Undertale fanfiction*.
So don’t let anyone shame you for what you write. There should be no limits to the greatest gift of them all- the imagination.
*This is not a dig at fanfiction, a hobby I strongly support in order to help the creative mind blossom. In fact, I have an old essay on the subject in which I argue this very point.