text: Malala Yousafzai was attacked on her way home from school in Mingora, the region's main town.
  She came to public attention in 2009 by writing a diary for BBC Urdu about life under Taliban militants who had taken control of the valley.
  A Pakistani Taliban spokesman told the BBC they carried out the attack.
  Ehsanullah Ehsan told BBC Urdu that they attacked her because she was anti-Taliban and secular, adding that she would not be spared.
  Malala Yousafzai was travelling with at least one other girl when she was shot, but there are differing accounts of how events unfolded.
  By Orla GuerinBBC News, Islamabad
  The chilling attack on the young peace campaigner has been leading TV news bulletins here. Malala Yousafzai is one of the best-known schoolgirls in the country.  Young as she is, she has dared to do what many others do not - publicly criticise the Taliban.
  Malala's confident, articulate campaign for girls' education has won her admirers - and recognition - at home and abroad. She has appeared on national and international television, and spoken of her dream of a future Pakistan where education would prevail.
  Even by the standards of blood-soaked Pakistan, there has been shock at the shooting. It has been condemned by Pakistan's Prime Minister, Raja Pervez Ashraf, who sent a helicopter to transfer Malala to hospital in Peshawar.
  The head of Pakistan's Independent Human Rights Commission, Zohra Yusuf, said "this tragic attack on this courageous child" sends a very disturbing message to all those working for women and girls.
  One report, citing local sources, says a bearded gunman stopped a car full of schoolgirls, and asked for Malala Yousafzai by name, before opening fire.
  But a police official also told BBC Urdu that unidentified gunmen opened fire on the schoolgirls as they were about to board a van or bus.
  She was hit in the head and, some reports say, in the neck area by  a second bullet, but is now in hospital and is reportedly out of danger.  Another girl who was with her at the time was also injured.
  Malala Yousafzai was just 11 when she was writing her diary, two years after the Taliban took over the Swat Valley, and ordered girls' schools to close.
  In the diary, which she kept for the BBC's Urdu service under a pen name, she exposed the suffering caused by the militants as they ruled.
  She used the pen-name Gul Makai when writing the diary. Her identity only emerged after the Taliban were driven out of Swat and she later won a national award for bravery and was also nominated for an international children's peace award.
  Correspondents say she earned the admiration of many across Pakistan for her courage in speaking out about life under the brutal rule of Taliban militants.
  One poignant entry reflects on the Taliban decree banning girls' education:  "Since today was the last day of our school, we decided to play in the playground a bit longer. I am of the view that the school will one day reopen but while leaving I looked at the building as if I would not come here again."
  She has since said that she wants to study law and enter politics when she grows up. "I dreamt of a country where education would prevail," she said.
  The BBC's Orla Guerin in Islamabad says that Malala Yousafzai was a public figure who didn't shy away from risks and had strong support from her parents for her activism. Indeed, her father, who is a school teacher, expressed his pride in her campaigning.
  In a statement about the attack, Pakistani Prime Minister Raja Pervez Ashraf said: "We have to fight the mindset that is involved in this. We have to condemn it... Malala is like my daughter, and yours too. If that mindset prevails, then whose daughter would be safe?"
  After the Taliban: Swat women on changing life
  The Taliban, under the notorious militant cleric Maulana Fazlullah, took hold of the Swat Valley in late 2007 and remained in de facto control until they were driven out by Pakistani military forces during an offensive in 2009.
  While in power they closed girls' schools, promulgated their extreme version of Sharia law and introduced measures such as banning the playing of music in cars.
  Since they were ejected, there have been isolated militant attacks in Swat but the region has largely remained stable and many of the thousands of people who fled during the Taliban years have returned.
target: Gunmen have wounded a 14-year-old rights activist who has campaigned for girls' education in the Swat Valley in north-west Pakistan.