Her famous journal was her last testament. But what happened to the precocious 15-year-old in the dark months before her death? Angela Lambert reports
Much of the material covered by Anne Frank's diary, up to the time the family was betrayed, is familiar. Details of the final months of her life - told by people who encountered the family during the seven months before liberation in 1945 - will be new to almost everyone, and they are harrowing.

Jon Blair, who produced and directed Anne Frank Remembered, the two-hour film about her life to be shown on BBC2 this Saturday, admits that often, as he and his film editor sat in a cutting room watching the research material they had assembled, they found themselves in tears.

For eyewitness accounts, Blair relied heavily on archive material and research assembled over the past 30 years by the Anne Frank House in Amsterdam. There he found contemporary film (including the only known movie footage of Anne, aged 12), letters, descriptions of the Frank family by friends, as well as the original of the famous diary. Many people who had known Anne were still alive. Jon Blair contacted them all, recording their extraordinary and moving testimonies to her memory.

Now that we can finally be sure of the truth about the events of Anne's last seven months, it is heartbreaking to realise by what a slender thread her life hung: how many times she almost escaped death; how nearly she survived. On 4 August 1944, having been betrayed by an anonymous telephone call, the hiding place in the back annexe above the office at Prinsengracht was entered by the security police. All eight inhabitants were captured and taken away. The diary - by now filling three volumes - was scattered over the floor.

For 50 years since then, Miep Gies, friend and protector of the Franks, who is now 86, has marked that black anniversary. She disconnects the telephone, draws the curtains and spends the day quite alone, silently remembering them all.

The morning after the Franks' arrest, with extraordinary courage, Miep went to the Nazi headquarters in Amsterdam and pleaded for their lives - in vain. The eight from the secret annexe were sent to Westerbork, the holding camp for Dutch Jews, where they remained for a month. Had their hiding place been discovered just a few weeks later, Anne, like 800 other Dutch Jews, would probably have seen out the war in the relative safety of Westerbork. As it was, on 3 September 1944, she and her family left on the very last transport to Auschwitz.

Frieda Menco, who was on the same train, recounts the experience: "It was like an endless journey, and even that was better than that there would come an end to it: because the end was not good - that we felt." After three days the train arrived at Auschwitz in south-west Poland. Men and women were separated. Otto Frank saw his wife and daughters for the last time.

Bloeme Evers-Emden, who had known Anne and her elder sister, Margot, before the war, was on that train. In the film, she describes what happened on arrival. "You were naked before men. I was educated chastely, in the values of my people. I got a shock. And I knew from this moment on that all your norms and values were of no importance any more; there was a quite new set of values to be learned, and if you didn't learn quick, you would be dead. That I realised in one second - and I was only 18 years old."

The next day, more than 500 of the new arrivals were gassed, including everyone under 15. Anne, by now 151/4, escaped that. She was also fortunate in managing to stay with her mother and sister. They formed a unit and gave one another comfort. Bloeme Evers-Emden recalls: "The last time I saw Anne and Margot and Mrs Frank was when there had been a selection for a working camp. Anne was not allowed to go with our group because she had scabies. Her mother and Margot decided to stay with her. Had they gone with our transport, they had a better chance to survive."

It was only because Anne developed scabies in Auschwitz-Birkenau that she was sent to disease-ridden Bergen-Belsen. Apart from that, in late 1944 she was still relatively strong and healthy, thanks to the food that Miep and her husband had risked their lives to supply them in hiding. Had she been sent to a labour camp, Anne might well have lived.

Mrs Frank was separated from her daughters on 28 October 1944 and died on 6 January 1945 of hunger and exhaustion. Anne and Margot were transported to Bergen-Belsen in Germany, which was being enlarged to take the final victims of the Nazis, still arriving in cattle trucks from all over Europe. If their bunk had not been the one next to the barracks door - the coldest, windiest and worst of all - would Anne have been less weakened; might she have survived? Again, one can only speculate.

Early in 1945, Anne's former schoolfriend Hanneli Goslar was told that Anne was in the camp. They arranged to meet on either side of a high fence. They could hear but not see one another. "And so I was standing there in the cold and I was waiting," Hanneli remembers. "Suddenly, I heard someone calling me, and this was Anne. I said, 'What are you doing here? You are in Switzerland!' and she answered, 'We wanted this rumour to go around because we hoped then the Germans would not look for us.'

"She said she had nobody any more. And this was not right, and I am so very sorry because ... I always think, if she had known her father was still alive, then maybe - you know, she only died one month before the liberation. But she didn't know, and so she really had nothing to live for."

Could that hope have kept her going? Her father did survive the camps, and he never wavered in the belief that his daughters were alive.

Anne Frank died of typhus before Bergen-Belsen was liberated by the British on 15 April 1945. The precise date of her death is not known, but it was probably during the first two weeks of March. Her body was heaped up with hundreds of others in a pile beside the barracks. She has no known grave.

But her diary remained. It was accidentally - almost miraculously - preserved because, when the police burst in on the Frank family in August 1944, they emptied Otto Frank's briefcase so as to have something in which to carry away valuables. In it were the three volumes and more than a hundred loose-leaf pages of Anne's diary, kept since she had received it from her parents as a 13th birthday present on 12 June 1942. All this fell unheeded to the floor. Next day, Miep Gies retrieved it and locked it away in her desk, unread, to await Anne's return.

Not until August 1945, when news of Anne's death was confirmed, did she give it to Otto Frank. "I took the diary out of my desk," she says, "and gave it to him with the words: that is a testament for your daughter Anne. Can you see how this man looked at me? Lost his wife - lost his two children - he had the diary."

In April 1946, an article in a Dutch newspaper about the diary prompted a small publishing house to offer to print an edited version. Het Achterhuis - The Back House, meaning the hidden annexe - appeared in June 1947. Nobody took much notice at first. Only in the Fifties, when translations began to appear, and in 1955, when it was turned into a Broadway play, did the diary reach a wider audience. In 1959, Millie Perkins starred as Anne in a Hollywood bio-pic, after which the diary took off, becoming one of the most widely read books of the 20th century.

Thousands of diaries survived the war, but none has had the same impact. Does Anne Frank's diary have genuine literary merit, or does it owe its success to the fact that Anne's fate symbolises the millions who vanished in the Holocaust, especially children? Would Anne have discovered that talent, had it not been for her years of confinement? I asked her childhood friend Hanneli Goslar, who lives in Jerusalem. "You know," she said, "in 1958 I went back to Holland and found the headteacher of the school Anne and I had gone to, and asked her the same thing. She said, 'If you take a child of 13 and shut her up away from the world, she will develop the talents that would have come out much later.' I am certain Anne Frank would have become a writer."

Can Hanneli still discern, behind the legend of Anne today, her schoolfriend from so long ago? "She was a nice child, an endearing child, though not without her faults. For me, it's funny that the girl I played with has become such a symbol, but at this moment I'm reading the diary again and I hear in it the voice of the real child I remember ... I do, I do ... And she so wanted to be very famous ..."

Laureen Nussbaum lived in the same neighbourhood as the Frank family and was at school with Anne. Now nearly 70, she is a retired professor of German literature. I spoke to her in Berlin and asked her how much literary merit she would ascribe to the diary.

"If we stick to the version that Anne planned for publication - not the hotchpotch that has emerged, but her own selection which she very deliberately addressed to a wider public - the diary is eminently qualified to be described as literature. It shows remarkable astuteness of observation, sense of humour and an extraordinary style.

"Anne had many presentiments that she might not survive the war. I know that she wanted to be 'the writer, Anne Frank' and to outlive herself as a writer rather than as a symbol. Even more, however, she wanted to survive in person."

I asked Dr Nussbaum if she retained any memory of Anne. "Memory easily fools you and my memory is coloured, inevitably, by the fact that she has become so famous. I always found her lively and keen, but would never have thought she would turn into this icon. I am afraid the icon has become, for some people, a source of income and the person Anne is obscured by this. She stands as a symbolic figure upon whom the world can heap both its guilt and its commiseration."

'Anne Frank Remembered' will be shown on BBC2 on Saturday 6 May at 8.55pm.

Inside: Beaches, babies and breakfast in bed: pictures from the Frank family albums, page 24