A 14-year-old Pakistani student who won international acclaim for speaking out for girls barred from school by the Taliban was critically wounded Tuesday by a gunman who boarded her school bus, asked for her by name, aimed his pistol at her head and fired, officials said.

The Pakistani Taliban asserted responsibility for the attack on ninth-grader Malala Yousafzai, who gained notice in early 2009 when she wrote a diary about Taliban atrocities under a pen name for the BBC’s Urdu service. Yousafzai lives in Mingora, a city in the scenic northwestern Swat Valley, where Taliban insurgents imposed harsh Islamic law for two years before being routed by a major military operation in May 2009.

Today, the army promotes Swat as a tourist destination — it sponsored a festival there in July, trying to restore its reputation as the Switzerland of Pakistan. Residents say militants rarely strike, but Tuesday’s daylight attack demonstrated the Taliban’s continued ability to infiltrate the area, which adjoins Pakistan’s insurgency-plagued tribal belt.

Two months ago, Taliban gunmen shot and seriously injured the president of Swat’s hotel association in Mingora and vowed further attacks on those it considers pro-government.

Many Pakistanis view Yousafzai, who also promoted literacy and peace, as a symbol of hope in a country long beset by violence and despair. In 2011, the Pakistani government awarded her a national peace prize and 1 million rupees ($10,500).

She also was a finalist last year for the International Children’s Peace Prize, awarded by a Dutch organization that lauded her bravery in standing up for girls’ education rights amid rising fundamentalism when few others in Pakistan would do so.

Yousafzai was flown by helicopter to a military hospital in Peshawar, where doctors on Wednesday said they removed a bullet lodged near her spine. The girl’s condition was improving, but officials said she had not yet regained consciousness. President Asif Ali Zardari directed that Yousafzai be sent abroad for further medical care if needed; the Interior Ministry arranged documents for her to enter Britain or the United Arab Emirates.

While school children throughout the nation held prayer vigils for Yousafza, and many Pakistanis and politicans expressed revulsion over the shooting, major religious parties and mosque leaders were largely silent. Clerics frequently do not rebuke suicide bombings or sectarian attacks for fear of alienating their increasingly conservative congregants or provoking the Taliban.

On Wednesday morning, Pakistan’s top military official, Chief of Army Staff Gen. Ashfaq Parvez Kayani,, became was the first national leader to visit the victim. He called the shooting “inhuman” and a “heinous act of terrorism,” the military’s information office said.

Kayani, arguably Pakistan’s most powerful man, quoted the words of the Prophet Muhammad: “The one who is not kind to children, is not amongst us,” the statement said.

The army has lost thousands of soliders and officers in its war with the Pakistani Taliban, which has stepped up its attacks and now frequently beheads captured troops.

“Islam guarantees each individual – male or female – equal and inalienable rights to life, property and human dignity,” Kayani said. “We wish to bring home a simple message: We refuse to bow before terror. We will fight regardless of the cost. We will prevail insha Allah [God willing].”

Pakistan’s prime minister and U.S. officials also condemned the attack.

“We have to fight the mind-set that is involved in this. We have to condemn it,” Prime Minister Raja Pervez Ashraf told the Pakistani Senate. “Malala is like my daughter and yours, too. If that mind-set prevails, then whose daughter would be safe?”

State Department spokeswoman Victoria Nuland called the shooting “barbaric” and “cowardly.”

A seventh-grader on the bus was shot in the leg. Classes had let out, and the vehicle was a few hundred yards from school grounds when the attack occurred, said Kamran Khan, a local administrator.

“A masked man stopped the school van, while another jumped in the rear asking for Malala,” he said. The driver tried to speed off, but the gunman had by then shot the teenager before jumping off and escaping.

Ihsanullah Ihsan, chief spokesman for the Pakistani Taliban, said in calls to the news media that the militant group targeted Yousafzai because she generated “negative propaganda” about Muslims.

“She considers President Obama as her ideal leader. Malala is the symbol of the infidels and obscenity,” Ihsan said, adding that if she survived, the Taliban would try again to kill her.

The Pakistani Taliban has bombed hundreds of schools, mostly for girls, in the tribal regions and in Khyber Pakhtunkhwa province, where Yousafzai lived.

Her father, Zia Uddin Yousafzai, is an educator and a member of Swat’s peace jirga, or tribal council.

“She is all right,” he said in an interview soon after the shooting. “Please pray for her early recovery and health.”

After being forced out of Swat, Pakistani Taliban fighters relocated to the Afghan border region near the eastern Afghan provinces of Konar and Nurestan. They are blamed for attacks on Pakistani forces from across the border.

In her diary, Yousafzai wrote about her fears and the growing Taliban influence. One morning, she wore her favorite pink dress. “During the morning assembly we were told not to wear colorful clothes as the Taliban would object to it,” she wrote.

In another entry, she wrote: “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.

Haq Nawaz Khan in Peshawar contributed to this report.