The question has long plagued fans of Harry Potter: Why did the boy wizard name his son after Severus Snape, a teacher who hated Harry's father and had been so cruel to him.

On Friday, author JK Rowling took to Twitter to answer the enduring question in an exchange with a fan who asked why one of Harry's children received the middle name of Severus.

The acclaimed author wrote: "Snape died for Harry out of love for Lily. Harry paid him tribute in forgiveness and gratitude."

Her response set fans into a frenzy of squabbling over the much-debated character, who many loathe for his treatment of Harry.

She responded on Twitter:

Rowling says that by honoring Snape, "Harry hoped in his heart that he too would be forgiven. The deaths at the Battle of Hogwarts would haunt Harry forever." The series of tweets have gotten tens of thousands of likes and retweets.

Here's how part of the Twitter exchange unfolded:

Later, she expanded on her comments:

The name choice is revealed in the final book of the mega-best-selling series. In "Harry Potter and the Deathly Hallows," Harry sends his second son off to Hogwarts with these words: "Albus Severus, you were named for two headmasters of Hogwarts. One of them was a Slytherin and he was probably the bravest man I ever knew."

In the book, each of Harry and Ginny's children is named in tribute to family and friends. His first son is named James Sirius and their daughter is named Lily Luna.

Rowling's seven Harry Potter novels have sold more than 450 million copies and been made into eight films.

The Associated Press contributed to this report.