“I want to go on living even after my death!” Anne Frank writes in one of the most unforgettable lines from her venerated “Diary,” the book that has done more than any other work of literature to give readers throughout the world a sense of what was lost in the genocide of six million Jews during the Holocaust. Some of those readers — who also happen to be writers — have responded to her call by turning her into a fictional character. A version of Anne who survives the war appears in at least three novels, most famously Philip Roth’s “The Ghost Writer” (1979), in which the young Nathan Zuckerman, Roth’s alter ego, encounters her as the attractive research assistant to his mentor and fantasizes about marrying her as a way of proving his Jewish bona fides to his parents.

To the best of my knowledge, “When We Flew Away,” by the acclaimed novelist Alice Hoffman, is the first book to imagine Anne’s life in the years before the diary, as the persecution of Jews in the Netherlands mounted. Starting in May 1940, just before the Nazi invasion, and continuing up to the day the Franks went into hiding, in July 1942, the novel envisions what Anne might have been like before the cataclysm that shut her away from the world and made her into “the voice of the Holocaust,” as Hoffman describes her in an afterword to the novel.

“Nobody saw/anything special/in her,” Jaap Meijer, Anne’s seventh-grade history teacher, later wrote in a poem about her. The Anne of Hoffman’s book, too, is an ordinary girl who quarrels with her apparently perfect older sister, Margot, and enjoys ice-skating with her friends until Nazi regulations forbid it. At night, she sneaks out of bed to eavesdrop on her parents’ conversations. When her father, Otto, tells her of his plan to bring the family to America, she dreams of California: celebrities, palm trees, the Pacific Ocean.

Still, there are glimpses of her emerging sensitivity and depth. She’s no great beauty, but when she starts to talk, it’s as if a light goes on inside her. She’s “so much more intense than most people.” And, even more than becoming a movie star, she longs for a friend who truly understands her.

It’s clear that Hoffman, who has said that the “Diary” was a formative book for her as a child, devoted a great deal of thought to the difficult balancing act of combining history and imagination. She researched Anne’s life and visited Amsterdam, touring the neighborhood and apartment where Anne grew up, and meeting with researchers at the Anne Frank House. “I was afraid; I wanted to do her justice,” she says in an interview published on the Jewish Book Council’s website.

Instead of trying to mimic Anne’s voice, Hoffman adopts the lyrical tone of a fairy tale, transforming Amsterdam and its surroundings into a fantastical, almost uncanny environment populated by rabbits, wolves and black moths that appear ominously in moments of stress or fear. Setting the well-known facts of Anne’s early life against this background heightens the contrast between the brutality of the world in which the Franks found themselves and the dreamscape of Anne’s imagination.

Perhaps because Anne’s story is so well known, the episodes drawn directly from life — such as her family’s thwarted attempts to emigrate to the United States — feel somewhat lacking in dramatic tension. More successful are the scenes Hoffman has invented, such as Anne’s encounter with a Nazi who accosts her for setting foot on the frozen river after Jews are no longer allowed to skate or her witnessing the harassment of a younger Jewish boy. “The Dutch schoolboys were circling the boy in the hat, coming closer to him all the time. … When Anne cried out for the boy to run, that was exactly what he did.”