Taliban gunmen in Pakistan have shot and seriously wounded a 14-year-old schoolgirl who rose to fame for speaking out against the militants.

Malala Yousufzai was shot in the head and neck when gunmen fired on her school bus in the Swat valley, northwest of the capital, Islamabad.

Two other girls were also wounded, police said.

Ms Yousufzai became famous for speaking out against the Taliban at a time when even the Pakistani government seemed to be appeasing the hardline Islamists.

The government agreed to a ceasefire with the Taliban in Swat in early 2009, effectively recognising insurgent control of the valley whose lakes and mountains had long been a tourist attraction.

The Taliban set up courts, executed residents and closed girls' schools, including the one that Ms Yousufzai attended.

A documentary team filmed her weeping as she explained her ambition to be a doctor.

"My friend came to me and said, 'for God's sake, answer me honestly, is our school going to be attacked by the Taliban?'," Ms Yousufzai, then 11, wrote in a blog published by the BBC.

"During the morning assembly we were told not to wear colourful clothes as the Taliban would object."

The army launched an offensive and retook control of Swat later that year, and Ms Yousufzai later received the country's highest civilian award.

She was also nominated for international awards for child activists.

Since then, she has received numerous threats.

Taliban spokesman Ehsanullah Ehsan said his group was behind today's shooting.

"She was pro-West, she was speaking against Taliban and she was calling President Obama her ideal leader," Mr Ehsan said by telephone from an undisclosed location.

"She was young but she was promoting Western culture in Pashtun areas," he said, referring the main ethnic group in northwest Pakistan and southern and eastern Afghanistan.

Most members of the Taliban come from conservative Pashtun tribes.