KARACHI, Pakistan — At the age of 11, Malala Yousafzai took on the Taliban by giving voice to her dreams. As turbaned fighters swept through her town in northwestern Pakistan in 2009, the tiny schoolgirl spoke out about her passion for education — she wanted to become a doctor, she said — and became a symbol of defiance against Taliban subjugation.
On Tuesday, masked Taliban gunmen answered Yousafzai’s courage with bullets, singling out the 14-year-old on a bus filled with terrified schoolchildren, then shooting her in the head and neck. Two other girls were also wounded in the attack.
All three survived, but late on Tuesday doctors said that Yousafzai was in critical condition at a hospital in Peshawar, with a bullet possibly lodged close to her brain.
A Taliban spokesman, Ehsanullah Ehsan, confirmed by phone that Yousafzai had been the target, calling her crusade for education rights an ‘‘obscenity.’’
''She has become a symbol of Western culture in the area; she was openly propagating it,’’ Ehsan said, adding that if she survived, the militants would certainly try to kill her again. ‘‘Let this be a lesson.’’
As Pakistan has struggled to address the Taliban’s tenacity, the militants have intensified their campaign to silence critics and drive out signs of government influence. That Yousafzai’s voice could pose such a threat to the Taliban — that they could see a schoolgirl’s death as desirable and justifiable — was seen as evidence of both the militants’ brutality and her courage.
‘‘She symbolizes the brave girls of Swat,’’ said Samar Minallah, a documentary filmmaker who has worked among Pashtun women. ‘‘She knew her voice was important, so she spoke up for the rights of children. Even adults didn’t have a vision like hers.’’
Yousafzai came to public attention in 2009 as the Pakistani Taliban swept through Swat, a picturesque valley once famed for its music, its tolerance and as a destination for honeymooning couples.
Her father ran one of the last schools to defy Taliban orders to end female education. As an 11-year-old, Malala — named after a mythic female figure in Pashtun culture — wrote an anonymous blog documenting her experiences for the British Broadcasting Corp. Later, she was the focus of documentaries by The New York Times and other media outlets.
''I had a terrible dream yesterday with military helicopters and the Taliban,’’ she wrote in one post titled ‘‘I Am Afraid.’’
The school was eventually forced to close, and Yousafzai was forced to flee to Abbottabad, the town where Osama bin Laden was killed last year. Months later, in summer 2009, the Pakistani army launched a sweeping operation against the Taliban that uprooted an estimated 1.2 million Swat residents.
The Taliban were sent packing, or so it seemed. An uneasy peace, enforced by a large military presence, settled over the valley.
Yousafzai grew in prominence, becoming a powerful voice for the rights of children. In 2011, she was nominated for the International Children’s Peace Prize. Later, Yousuf Raza Gilani, the prime minister at the time, awarded her Pakistan’s first National Youth Peace Prize.
Mature beyond her years, she recently changed her career aspiration to politics, friends said. In recent months, she led a delegation of children’s rights activists, sponsored by UNICEF, which made representations to provincial politicians in Peshawar.
‘'We found her to be very bold, and it inspired every one of us,’’ said another student in the group, Fatima Aziz, 15.
‘'She had this vision, big dreams, that she was going to come into politics and bring about change,’’ said Minallah, the documentary maker.
That such a figure of wide-eyed optimism and courage could be silenced by Taliban violence was a fresh blow for Pakistan’s beleaguered progressives, who seethed with frustration and anger on Tuesday.
‘'Come on, brothers, be REAL MEN. Kill a school girl,’’ one media commentator, Nadeem F. Paracha, said in an acerbic Twitter post.
In Parliament, Prime Minister Raja Pervez Ashraf urged his countrymen to battle the mindset behind such attacks.
‘'She is our daughter,’’ he said.
The attack was also a blow for the powerful military, which has long held out its Swat offensive as an example of its ability to conduct successful counterinsurgency operations. The shooting occurred in the center of Mingora, Swat’s largest town, offering further evidence that the Taliban remain a deadly force.
''This is not a good sign,’’ Kamran Khan, the most senior government official in Swat, said by phone.