[Updated. Malala is now in London receiving medical care.]

On Tuesday afternoon, Taliban militants attacked and seriously injured Malala Yousafzai, a fourteen-year-old campaigner for education for girls in Mingora, a town in Swat Valley, in Pakistan’s North Western Frontier Province. Malala was returning home from school when the men attacked; a fellow-student and a teacher were injured as well. “A bullet struck her head, but her brain is safe,” a doctor told the Express Tribune newspaper. Malala was flown in a military helicopter to a military hospital in Peshawar, the insurgency-torn capital of North Western Frontier Province; Pakistani President Asif Ali Zardari has arranged for her to be flown out of Pakistan to get the complex surgery needed to save her. Malala was not a random target. A Pakistani Taliban spokesman, Ehsanullah Ehsan, claimed responsibility and threatened to attack her again, if she survives: “She was pro-West, she was speaking against the Taliban and she was calling President Obama her idol.” He added, “She was young but she was promoting Western culture in Pashtun areas.”

“She was just the girl who wanted to go to school,” Mirza Waheed, the former editor of the Urdu Web site of BBC World Service, told me. One foggy winter afternoon in early 2009, when Mirza was working out of the BBC World Service’s Bush House offices in London, he got a proposal from one of his reporters in Pakistan, who was covering the takeover of Swat Valley by the Taliban militants led by Maulana Fazlullah, or “FM Mullah.” Fazlullah had banned TV, music, and girls’ education; bodies of beheaded policemen were hanging from town squares. Abdul Hai Kakkar, the reporter, had first approached Ziauddin Yousafzai, a local school director, to get a female teacher to write about life under the Swat Taliban. No teacher agreed, but his eleven-year-old daughter, a seventh-grade student, was interested in writing a diary. “Would they publish the diary?” the reporter asked.

“We had been covering the violence and politics in Swat in detail but we didn’t know much about how ordinary people lived under the Taliban,” Mirza said. (He left the BBC to be a full-time novelist; his book “The Collaborator” is about the war in Kashmir.) “We unanimously decided to publish the diary, but her safety was of utmost concern to us and we decided to use a pseudonym,” Mirza said. “The Diary of a Pakistani School Girl,” written by Malala Yousafzai, was published under the byline Gul Makki. “Malala passed on hand-written diary pages to our reporter and he would scan and e-mail or fax them to me,” Mirza said. “I would edit it to retain its directness, its raw texture, and at times, as I edited her, I would well up.”

I first read Malala’s diary in the summer of 2009, while reporting on the refugee crisis in North West Frontier Province following the battles between the Swat Taliban and the Pakistani Army. Like thousands of others, I knew her by the pseudonym. The scale of her courage struck me, as did the importance of her bearing witness. As I travelled through refugee camps and in villages and towns, I often read and reread her diaries online. A haunting entry, which was also translated into English (the diaries in Urdu are more detailed) described the psychological price that life under tyranny, and amid violence, exacted:

On my way from school to home I heard a man saying “I will kill you.” I hastened my pace and after a while I looked back if the man was still coming behind me. But to my utter relief he was talking on his mobile and must have been threatening someone else over the phone.

And another:

I had a terrible dream yesterday with military helicopters and the Taliban. I have had such dreams since the launch of the military operation in Swat. My mother made me breakfast and I went off to school. I was afraid going to school because the Taliban had issued an edict banning all girls from attending schools. Only 11 students attended the class out of 27. The number decreased because of Taliban’s edict.

The Taliban had blown up more than a hundred girls’ schools. A video feature by the Times, published in 2009, describing the life of Malala’s family, shows her in her school, a girl with a fair, round face, hazel eyes, carrying a satchel with a Harry Potter picture on it.

She would be featured in two Times videos, which brought her considerable attention, but Malala became a celebrity in Pakistan in October, 2011, when Desmond Tutu announced her nomination for an international children’s prize. It seems to have been the first time that her identity as the writer of the BBC diary became known to the broader public; the citation for her nomination mentioned her use of “international media to let the world know girls should also have the right to go to school.”

Her public profile rose further after the Pakistan government awarded her the first National Peace Prize, in December 2011. “In a situation where a lifelong school break was being imposed upon us by the terrorists, rising up against that became very important, essential,” she told a Pakistani television network. When the interviewer asked her about fear and danger, Malala, speaking in a clear, forceful voice, said that her father, who worked for women’s education and fully supported his daughter, had inspired her, and that her mother had told her to speak up for her rights. And then, in a rather prophetic moment, she envisioned a confrontation with the Taliban.

I think of it often and imagine the scene clearly. Even if they come to kill me, I will tell them what they are trying to do is wrong, that education is our basic right.

The growing fame and her determination to speak out for girls’ education put her on the Taliban radar. Malala was active on Facebook under her own name, and the extremists would threaten her online. The cover photo of a public Facebook page dedicated to her is an exhortation to primary education, a cause she embraced and lived from a very young age: “One in ten of the world’s children who don’t go to primary school live in Pakistan.” And a flood of messaging is expressing support, saying prayers for her. “plz stay with us. we need the girls like u fo betterment of Pakistan,” a young girl wrote. Pakistan will be richer, if Malala Yousafzai makes it.

Photograph: AP.