JK Rowling threatened legal action after publicly criticising Glasgow MP Natalie McGarry for accusing her of supporting a “misogynist Twitter troll”.

The writer repeatedly challenged the MP to explain how she has "defended misogyny and abuse" in the a social media row that lasted six hours.

And the author said the MP, who recently quit the SNP whip to become an independent,  would have to apologise if she could not justify her accusation.

Ms McGarry's online accusations came about after she discovered Ms Rowling conversing with a tweeter she claimed was a troll.

Ms Rowling had sent a "good man" message to a Tweeter who had said he had contributed to children's charity Lumos.

Ms McGarry then produced a screen grab of a foul tweet sent by the donor to one of her SNP colleagues.

Later Ms McGarry appeared to apologise saying: "Dear @jk_rowling. On reflection, I do apologise for any misguided inference that you support misogyny or abuse instead of the folk you tweet.

“On reflection, I shouldn't have accused Joanne Rowling of anything based on folk she tweets or retweets, and sends supportive tweets to."

But then later after saying she was to get on a plane from London to Glasgow, Ms McGarry repeated the accusation with another screen grab of the donor’s foul tweet with Ms Rowling's “good man” tweet tacked on.

Ms Rowling retorted: “*sighs* OK, Natalie, that's cut and pasted to suggest I said 'good man' to that tweet, not to fundraising for charity.

“This 'proof' is cut and pasted. I assume you want to retract the apology you made 3 mins ago?”

Later Ms McGarry said she was going to quit Twitter. 

Ms Rowling told Ms McGarry: "You don't appear to understand how Twitter or defamation works. I'm going to help you out with the latter."  She later said damages would go to the Lumos.

In the early hours of Friday morning, six hours after the row began, Ms McGarry's Twitter feed became hidden from public view with only confirmed followers having access.

A spokeswoman for the author said: "JK Rowling won’t be saying anything further than what is on her Twitter feed..."