JK Rowling has been hailed an “inspiration” after she was asked by a young Harry Potter fan why Hogwarts headmaster Albus Dumbledore was gay.

Rowling, 49, revealed Dumbledore's sexuality almost a decade ago in 2007, after the final book, Harry Potter and the Deathly Hallows, was published.

In a tweet that has since been deleted, fan Ana Kocovic asked: “Thank you so much for writing Harry Potter. I wonder why you said that Dumbledore is a gay because I can’t see him in that way.”

The author’s powerful response was simply: “Maybe because gay people just look like…people?”

Ms Kocovic then thanked the author, who has tweeted only 600 times since joining the website in 2009.

Rowling said when she revealed Dumbledore’s sexuality: “It has certainly never been news to me that a brave and brilliant man could love other men.

“He is my character. He is what he is and I have the right to say what I say about him."

Harry Potter through the ages Show all 8 1 /8 Harry Potter through the ages Harry Potter through the ages Harry Potter and the Philosopher's Stone The first film introduced Daniel Radcliffe to our screens, pictured here as he prepares to board the train to Hogwarts for the first time. Harry Potter through the ages Harry Potter and the Chamber of Secrets The second installment saw Harry come face to face with Voldemort again, but in an incarnation of his youthful self. Daniel Radcliffe was thirteen when the film came out. Harry Potter through the ages Harry Potter and the Prisoner of Azkaban The third installment of the franchise saw Harry meet his Godfather and discover more about his family. Despite being one of the lower grossing Potter films, the Prisoner of Azkaban was critically acclaimed by reviewers, but Potter fans resented the changes made to the plot. Harry Potter through the ages Harry Potter and the Goblet of Fire Harry arrives in the graveyard to be confronted by Voledemort in the fourth instalment, Harry Potter and the Goblet of Fire. Harry Potter through the ages Harry Potter and the Order of the Phoenix Acclaimed as the 'best film yet' by Rowling on it's release in 2007, The Order of the Phoenix grossed nearly $940m in total. In this scene Harry fights off a dementor after it attacks his cousin Dudley Dursley. Harry Potter through the ages Harry Potter and the Half-Blood Prince As the characters grew older, JK Rowling's narrative arc grew progressively darker with Harry facing evil forces more than ever. Harry Potter through the ages Harry Potter and the Deathly Hallows The final book of the seven-long series was turned into two epic-length films. Harry Potter and the Deathly Hallows marked a departure from Hogwarts and a traditional 'Potter' story arc. Harry Potter through the ages Harry Potter and the Deathly Hallows The final film, Harry Potter and the Deathly Hallows Part II, was softer in tone, with Harry, Ron and Hermione seeing their children off to Hogwarts.

The incident is not the first time the author has defended making Dumbledore gay.

Late last autumn, Rowling, who campaigned against Scottish independence last year, responded to a fan who said he stopped being a fan after she revealed the character was gay.

“Nice how u blindsided us with that one. Enjoy your billion $ (sic).”

She told the former fan to follow Brian Souter on Twitter instead.

The Stagecoach founder funded a campaign to try and stop the Scottish government from repealing Section 2A of the Local Government Act.

The amendment, repealed in 2000, stated that local authorities “shall not intentionally promote homosexuality or publish material with the intention of promoting homosexuality” or “promote the teaching in any maintain school of the acceptability of homosexuality as a pretended family relationship”.