JK Rowling has revealed her frustration at online reaction by “a bunch of racists” to news that the role of Hermione will be played by a black actress in the eagerly awaited new play Harry Potter and the Cursed Child.

JK Rowling: ‘Harry Potter’s world is always in my head’ Read more

The production, which has broken records by selling 175,000 tickets in 24 hours, is tipped to be the theatrical event of the year. But the Harry Potter creator criticised those who have suggested that Hogwarts’ studious heroine could not be played by the Olivier-award-winning actress Noma Dumezweni.

“With my experience of social media, I thought that idiots were going to idiot,” she said in an interview with the Observer. “But what can you say? That’s the way the world is. Noma was chosen because she was the best actress for the job.”

While the vast majority of people responded positively to the casting decision, Rowling said: “I had a bunch of racists telling me that because Hermione ‘turned white’ – that is, lost colour from her face after a shock – that she must be a white woman, which I have a great deal of difficulty with. But I decided not to get too agitated about it and simply state quite firmly that Hermione can be a black woman with my absolute blessing and enthusiasm.”

Dumezweni was cast by the play’s director, John Tiffany – known for the productions Black Watch and the musical Once – who has collaborated with Rowling and the playwright Jack Thorne, writer of This Is England and The Last Panthers.

Tiffany said he was surprised by the opinions expressed online, but had stopped reading the comments. “I am not as Twitter-familiar as Jo and Jack, so I hadn’t encountered its dark side, which is just awful. But what shocked me was the way people couldn’t visualise a non-white person as the hero of a story. It’s therefore brilliant that this has happened.”

Rowling has pointed out that there is no reason why Hermione should be white. The books don’t explicitly mention her race or skin colour, and she is often portrayed as black in fan art.

Facebook Twitter Pinterest JK Rowling said Hermione ‘can be a black woman with my absolute blessing and enthusiasm’. Photograph: Cindy Ord/Getty Images

The two-part production will open at the Palace Theatre in London’s West End at the end of July. Last week, audiences for previews were asked to arrive an hour early and have their bags searched. The request follows controversy surrounding Benedict Cumberbatch’s Hamlet at the Barbican, when security staff struggled to prevent audience members from filming or photographing, forcing the the star to urge fans not to record his performance.

The play’s creators have remained tight-lipped about the plot, releasing only brief clues on social media and the Pottermore website. The story is expected to pick up where the seventh, and final, book left off – Harry is an overworked employee of the Ministry of Magic and married with three school-age children. The play will focus on Harry’s youngest son, Albus, who “must struggle with the weight of a family legacy he never wanted”.

Rowling – who contributed ideas but handed scriptwriting responsibility to Thorne – described the production as extraordinary. Writing for theatre was a new language, she said. “So watching Jack and what he can do on the page and his understanding on what will then translate on to stage has been such a revelation to me.”

She added that Potter had never left her. “It was 17 years, and just because I’ve stopped on the page doesn’t mean my imagination stopped,” she said. “It’s like running a very long race. You can’t just stop dead at the finishing line. I had some material and some ideas and themes, and we three [she nods at Tiffany and Thorne] made a story.”