No one expected the news from Oslo this time.

Last year, supporters of Malala Yousafzai in her native Swat Valley defied possible backlash from Taliban-backed militants and organized events to await word on the Nobel Peace Prize, which went to an organization seeking a ban on chemical weapons.

On Friday — just after the second anniversary of the gunshots by Taliban militants that changed her life — word raced through Mingora: The 17-year-old Yousafzai was a co-winner of the prize for her global advocacy of education for women and girls.

“I am speechless on awarding Malala with the Nobel,” said Ahmad Shah, 45, an educator and close aide of her father, Ziauddin Yousafzai, who ran a public school. “I am happy that now our Swat will be known by Malala’s Nobel Peace Prize, and that is more than everything.”

But there is still the shadow of the Pakistani Taliban and its backers in the Swat Valley, a region of stunning beauty and bloody ideological struggles in the tribal areas along the border with Afghanistan.

Malala Yousafzai, who was shot by the Taliban while traveling to school in Pakistan in 2012, speaks at the United Nations in July 2013. (United Nations/The Washington Post)

Years of offensives by the Pakistani military have significantly loosened the once-tight grip of the Taliban, but militants have shown some signs of resilience with attacks on political figures and other opponents.

Such retaliation was carried out in October 2012 when masked gunmen shot Yousafzai in the head in apparent reprisal for her calls to keep girls’ schools open. Two other girls were wounded in the attack in Mingora.

“Before militancy, Swat was known for its beauty and education,” said Shah, who runs a private school in Mingora. “And, thank God, this award will help the revival of education in Swat. This is a huge victory for not only Swat, but Pakistan.”

Shah recalled the comment by a girl student when asked what she wanted to become in the future. Her reply: “I want to become Malala Yousafzai to work for education and peace,” said Shah.

“This is great news for Swat,” added Ayub Hilal, a 35-year-old merchant.

“I have been through the militancy and never fled Swat even during the military operation in May 2009,” he said. “But I see this award as a sign of smile on our faces.”

Not all agree. In the past, some in Mingora have criticized Yousafzai’s worldwide fame, denouncing events such as a 2013 address at the United Nations as ma­nipu­la­tion by the West. Threats have prevented Yousafzai from returning home since her recovery.

One girls’ college in Mingora was named after Yousafzai shortly after the attack, but the students protested that they could be vulnerable to violence. The name was removed.

“Some people are silent, as they don’t like her and her father, but others are quiet due to the possible threat from the militants,” said Aftab Ali, a 41-year-old businessman.

Yousafzai’s first cousin, Mahmood ul Hassan, 34, said he received a call from the girl’s mother, Toor Pekai, moments after the Nobel was announced.

“Malala’s Noble award is a clear message from Swat that we are peaceful and peace-loving people,’’ he said. “Once Swat was notorious for the terrorism and militancy, but now the world will call Swat as the hometown of Noble peace award winner.”

He dismissed the possible threats from militants, saying the uplifting message was far greater than the fears. “Death and life is in the hands of God,” he said, “but the pride Malala won is unforgettable.”

In the rest of Pakistan, the reaction to the prize appeared relatively muted. In an eastern part of the country — far from Yousafzai’s home region — many people said they did not even recognize her name.

But the country’s president, prime minister and powerful military congratulated her as Pakistan’s second Nobel winner. Abdus Salam, a researcher in theoretical physics, won the Nobel physics prize in 1979.

“Except for terrorists, all Pakistanis want their children in school,” wrote Maj. Gen. Asim Bajwa, the chief military spokesman, on his Twitter account.

A seventh-grade girl at a private school in Mingora, Hadeeqa Bashir, recalled meeting Yousafzai — then a young teenager — during a peace rally. The 13-year-old Bashir called the Nobel a reward for her “sacrifices and struggle.”

A social activist, Fazal Maula Zahid, 47, envisions a time when Yousafzai can return.

“We want Malala to establish the first Swat women’s university,’’ he said, “and change Swat into the valley of education.’

Tim Craig in Lahore, Pakistan, contributed to this report.