JK Rowling has written to a teenager who found strength in the words of a Harry Potter film after her entire family were shot dead.

Cassidy Stay, 15, from Texas, America, survived the attack by playing dead but her mother, father, two younger sisters and two younger brothers were all murdered by the gunman in the July 9 attack.

In a moving speech she made at a memorial just days after the murders she quoted the fictional headmaster Albus Dumbledore, telling mourners: " Happiness can be found even in the darkest times if one only remembers to turn on the light."

An online campaign to get JK Rowling to contact the teenager led to the world-famous author writing to Cassidy in the voice of Dumbledore, The Daily Telegraph reported.

The handwritten note of comfort, written in purple ink, was accompanied by a wand, an acceptance letter to Harry Potter's school Hogwarts, a list of school supplies and a signed book.

A spokesman for the 49-year-old author told the newspaper: "We can confirm that JK Rowling was in touch with Cassidy Stay, however, the contents of the letter remain private."

Asked whether a meeting between the two may happen, she added: "We wouldn't comment on that but [Cassidy's] is a remarkable story."

At the memorial Cassidy said: "In The Prisoner Of Azkaban, Dumbledore says, 'Happiness can be found even in the darkest times if one only remembers to turn on the light'.

"I know that my mom, dad, Bryan, Emily, Becca, and Zach are in a much better place and that I'll be able to see them again one day. Stay strong."

The line quoted by Cassidy is spoken by Harry Potter's mentor Dumbledore - played by Sir Michael Gambon - as he addresses the pupils of Hogwarts in the Great Hall at the start of the film The Prisoner Of Azkaban.

The quote is credited to writer Steve Kloves, who transformed all seven books into screenplays.