"Harry Potter" author JK Rowling revealed on Wednesday she is a survivor of domestic abuse and sexual assault.

The celebrated British writer said in a blog post that she was disclosing the information to give context to her controversial past comments about transgender women.

"This isn't an easy piece to write," Rowling said in a 3,695-word essay on gender identity and her own troubled past.

"I've been in the public eye now for over twenty years and have never talked publicly about being a domestic abuse and sexual assault survivor," Rowling wrote.

"This isn't because I'm ashamed those things happened to me, but because they're traumatic to revisit and remember."

Rowling caused a scandal by tweeting last weekend about "people who menstruate".

"I'm sure there used to be a word for those people. Someone help me out. Wumben? Wimpund? Woomud?"

The tweet forced "Harry Potter" star Daniel Radcliffe to apologise to trans women who may have been offended by Rowling's remark.

"Transgender women are women," Radcliffe wrote in a post for The Trevor Project website.

The feud dated back to comments from December in which Rowling expressed support for a woman who had lost her job over what her employer deemed to be "transphobic" tweets.

Rowling said on Wednesday that "accusations and threats from trans activists have been bubbling in my Twitter timeline" ever since.

"Huge numbers of women are justifiably terrified by the trans activists; I know this because so many have got in touch with me to tell their stories," she wrote.

Rowling ended her post by affirming that she was "a survivor (and) certainly not a victim".

JK Rowling says she has suffered domestic abuse and sexual assault in the past
JK Rowling says she has suffered domestic abuse and sexual assault in the past AFP / Angela Weiss

"I haven't written this essay in the hope that anybody will get out a violin for me, not even a teeny-weeny one," she said.

"I've only mentioned my past because, like every other human being on this planet, I have a complex backstory, which shapes my fears, my interests and my opinions."

Rowling said she had spent many years thinking about trans issues because of her own troubles with gender identity when she was young.

"When I read about the theory of gender identity, I remember how mentally sexless I felt in youth," she wrote.

"As I didn't have a realistic possibility of becoming a man back in the 1980s, it had to be books and music that got me through both my mental health issues and the sexualised scrutiny and judgement that sets so many girls to war against their bodies in their teens."

The 54-year-old said she spent a period feeling "ambivalence about being a woman" before learning that "it's OK to feel confused, dark, both sexual and non-sexual, unsure of what or who you are".

She also argued that "the current explosion of trans activism" has resulted in too many people undergoing gender reassignment surgery without giving it sufficient thought.

"I want to be very clear here: I know transition will be a solution for some gender dysphoric people, although I'm also aware through extensive research that studies have consistently shown that between 60-90 percent of gender dysphoric teens will grow out of their dysphoria," she said.

"So I want trans women to be safe. At the same time, I do not want to make... girls and women less safe."

But she also stood up for her right to speak freely about an issue that she said has been with her throughout life.

"As a much-banned author, I'm interested in freedom of speech and have publicly defended it, even unto Donald Trump," she wrote.

Rowling's books have been banned in parts of the world because of their association in some cultures with witchcraft and the occult.