JK Rowling has been subjected to obscene online abuse after becoming the pro-UK campaign's biggest donor by giving £1 million.

The Harry Potter author was variously labelled a "specky b******", a "Union cow bag" and a "disgrace" in social media posts from fervent nationalists.

One Edinburgh-based charity is being investigated by regulators after calling Rowling a "b****" in a message sent from its official Twitter account.

"What a #b**** after we gave her shelter in our city when she was a single mum," the tweet read.

The Dignity Project, which promotes the education for African children, later claimed the account had been hacked and said "people are free to donate to whoever they choose".

The Prime Minister's official spokesman condemned the messages, saying there is "never any place for abusive behaviour in whatever sphere of life".

The reaction from so-called cybernats – online nationalists who attack prominent figures that speak out for the Union – followed a blog post written by Rowling.

The writer, who was born in England and has lived in Scotland for 21 years, compared extreme nationalists to Death Eaters – supporters of the evil Voldemort in her Harry Potter series who hate people without "pure-blood".

She also warned voters considering backing separation against making a “historically bad mistake”.

"The more I listen to the Yes campaign, the more I worry about its minimisation and even denial of risks," said Rowling, who is worth approximately £560 million.

In particular, she said she was concerned about the future of medical research in Scotland if left the UK. She has previously donated large amounts of money to research in Scotland into Multiple Sclerosis, the disease of which her mother died.

If it rejects independence, Rowling predicted that Scotland would be “in the heady position of the spouse who looked like walking out, but decided to give things one last go.”

She argued that Scotland would never be in a better position to “dictate terms” on what extra powers should be given to Holyrood, with all three of the main UK parties promising extra devolution.

Her donation represented a significant boost for Better Together, which was concerned about being outspent by the opposing pro-separation Yes Scotland campaign.

It emerged last month that Yes Scotland is almost entirely bankrolled by an SNP-supporting couple who won the Euromillions lottery.

Chris and Colin Weir have handed over £3.5 million to Yes Scotland since it was founded two years ago, according to the most up-to-date figures, almost 80 per cent of its total cash income of £4.5 million.

Their contributions meant Yes Scotland had raised nearly £4.9 million compared to the £2.8 million declared by Better Together in December.

Rowling, who has close links to the Labour Party, recently attended a special comedy concert hosted by Eddie Izzard in Edinburgh that was part of a drive to convince Scots the English do not want them to leave the Union.

Senior party figures in Holyrood and Westminster condemned the reaction from some nationalists on social media.

John Lamont, Scottish Conservative Chief Whip, said that Rowling was one of Scotland’s "best known exports" and a "tremendous ambassador for the country".

“Yet today, because she has decided to back the case to keep Scotland part of the UK she is forced to endure the most extreme personal abuse imaginable," he said.

Baroness Liddell of Coatdkye, a former Scotland secretary and Labour peer, said: "I cannot repeat some of the things that have been said. It contains words that I have never used and nor will I ever use."

"This is a shame on my country and I am appalled and I urge the First Minister to stand up for the decent people of Scotland who will have nothing to do with this," she added in a House of Lords debate.

A spokesman for Yes Scotland said: "While we may disagree with her views, we of course completely respect JK Rowling and her right to express her opinion on the referendum and donate to the No campaign.

"And while we do not agree with her choice, we can all agree with her strong point that if the majority of people in Scotland do vote Yes, then she truly hopes that it is a 'resounding success'."

William and Barbara Anne Wood, who run The Dignity Project charity, denied posting the message calling Rowling a "b****" and said they only became aware of the tweet when alerted by friends.

"It's caused us nothing but grief. Somebody sent me a phone message to say this had happened. My reaction was horror and disbelief," said Mr Wood.

"Somebody tweeted the message from The Dignity Project without our knowledge and without our opinion. Somebody hacked our Twitter account.

“It's malicious. Somebody doesn't like what we do and I think they are trying to cause us hassle.

“We started as a small charity and we still are a small charity. We did our best. The last thing we need is being crucified by something like this. It's crazy."

The couple were unable to tell whether another member of their charity or a hacker could have posted the message. Mr Wood admitted that at least 10 people, including present and former members, had access to the login details for the account.