Ms Rowling revealed she was considering taking a ­defamation case after Ms McGarry claimed the author had “tweeted support” of a Twitter user, who uses the nom de plume of Brian Spanner QC to attack Scottish Nationalism.

A series of tweets were posted by Ms McGarry, whose political career has been marred by her suspension from the SNP after financial irregularities were discovered in a pro-independence group that campaigned during the referendum.

But the row escalated when Ms McGarry subsequently tweeted an image that had been altered to wrongly suggest Ms Rowling had responded “you’re a good man” to an abusive tweet sent by Brian Spanner.

According to the author, Ms McGarry had taken the “good man” tweet out of context. Rather than a response to an abusive tweet, it had actually been posted when Brian Spanner helped to raise money for Ms Rowling’s Lumos children’s charity.

Ms Rowling countered saying: “I assume the apology’s retracted, given the cut and paste screenshot you sent misrepresenting my interaction with BSpanner?” She added: “It is your view that if person A interacts with person B on Twitter, they must be “supportive” of B’s every tweet?”

The threat of legal action surfaced when Ms Rowling tweeted: “You don’t appear to understand how Twitter or defamation works.

“I’m going to help you out with the latter.”

She later suggested that money won from a court case would go towards her Lumos charity. “I’m thinking all damages to @lumos!” she tweeted.

Last night Ms McGarry had made her twitter account private.

The MP, who was elected in May last year at the expense of Labour’s shadow Scottish Secretary Margaret Curran, withdrew from the SNP whip last November.

She quit following allegations that tens of thousands of pounds in donations may be missing from Women for Independence, the campaign group she helped found and which played a prominent role in the 2014 referendum.